*.go: add a golang webserver for this project

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2024-03-21 10:46:45 -04:00
parent 025604ce28
commit 58ebeb91d8
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
2 changed files with 29 additions and 0 deletions

9
content.go Normal file
View file

@ -0,0 +1,9 @@
package main
import (
"embed"
)
//go:embed "htmx.min.js"
//go:embed "index.html"
var content embed.FS

20
main.go Normal file
View file

@ -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())
}