Skip to content

Commit a130fa9

Browse files
committed
updated for html serve
1 parent 3407d9e commit a130fa9

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#### To Do
2727

2828
- [x] Make std output/logs colored and pretty 😅
29+
- [x] Serving html file as output on ```/html/``` endpoint
2930
- [ ] Add Environment Variable to switch text output to html output
3031
- [ ] Serve a html pages from a external directory
3132
- [ ] Add volume Env var to serve volume as http dir

html/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Simple HTTP Server</title>
7+
</head>
8+
<body>
9+
<h1>Welcome to Simple HTTP Server</h1>
10+
<h3>by Paresh Pawar</h3>
11+
</body>
12+
</html>

simple_http_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
func main() {
1515
http.HandleFunc("/", handler)
16+
http.Handle("/html/", http.StripPrefix("/html/", http.FileServer(http.Dir("./html"))))
1617
serverBrand := figure.NewColorFigure("Simple HTTP Server", "straight", "green", true)
1718
serverBrand.Print()
1819
myBrand := figure.NewColorFigure("by PareshPawar.com", "term", "green", true)

0 commit comments

Comments
 (0)