From a130fa964d40a0b2cf89c70c891a9115d8d61941 Mon Sep 17 00:00:00 2001 From: Paresh Pawar <25054775+pareshpawar@users.noreply.github.com> Date: Wed, 18 Oct 2023 10:35:29 +0000 Subject: [PATCH] updated for html serve --- README.md | 1 + html/index.html | 12 ++++++++++++ simple_http_server.go | 1 + 3 files changed, 14 insertions(+) create mode 100644 html/index.html diff --git a/README.md b/README.md index 921dd92..85f6f2a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ #### To Do - [x] Make std output/logs colored and pretty 😅 +- [x] Serving html file as output on ```/html/``` endpoint - [ ] Add Environment Variable to switch text output to html output - [ ] Serve a html pages from a external directory - [ ] Add volume Env var to serve volume as http dir diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..786241d --- /dev/null +++ b/html/index.html @@ -0,0 +1,12 @@ + + + + + + Simple HTTP Server + + +

Welcome to Simple HTTP Server

+

by Paresh Pawar

+ + \ No newline at end of file diff --git a/simple_http_server.go b/simple_http_server.go index ac2a8a2..7cb4054 100644 --- a/simple_http_server.go +++ b/simple_http_server.go @@ -13,6 +13,7 @@ import ( func main() { http.HandleFunc("/", handler) + http.Handle("/html/", http.StripPrefix("/html/", http.FileServer(http.Dir("./html")))) serverBrand := figure.NewColorFigure("Simple HTTP Server", "straight", "green", true) serverBrand.Print() myBrand := figure.NewColorFigure("by PareshPawar.com", "term", "green", true)