From 58ebeb91d84d732986912bebfbfead9d9e4c63dd Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 21 Mar 2024 10:46:45 -0400 Subject: [PATCH] *.go: add a golang webserver for this project Signed-off-by: Vincent Batts --- content.go | 9 +++++++++ main.go | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 content.go create mode 100644 main.go diff --git a/content.go b/content.go new file mode 100644 index 0000000..d81d807 --- /dev/null +++ b/content.go @@ -0,0 +1,9 @@ +package main + +import ( + "embed" +) + +//go:embed "htmx.min.js" +//go:embed "index.html" +var content embed.FS diff --git a/main.go b/main.go new file mode 100644 index 0000000..ab8d4e3 --- /dev/null +++ b/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "log" + "net/http" + "time" +) + +func main() { + + s := &http.Server{ + Addr: ":8080", + //Handler: myHandler, + ReadTimeout: 10 * time.Second, + WriteTimeout: 10 * time.Second, + MaxHeaderBytes: 1 << 20, + } + http.Handle("/", http.FileServer(http.FS(content))) + log.Fatal(s.ListenAndServe()) +}