Embed the static dir

main
Jasper Bok 2023-08-13 16:57:38 +02:00
parent 5a78251b76
commit 465b033971
1 changed files with 4 additions and 0 deletions

View File

@ -8,6 +8,9 @@ import (
"time" "time"
) )
//go:embed static
var staticDir embed.FS
//go:embed index.html //go:embed index.html
var indexTemplate string var indexTemplate string
@ -29,6 +32,7 @@ var tplFunctions = template.FuncMap{"formatTime": formatTime}
func serveHttp() { func serveHttp() {
http.HandleFunc("/", handleIndex) http.HandleFunc("/", handleIndex)
http.Handle("/static/", http.FileServer(http.FS(staticDir)))
log.Println("Serving on port 4444") log.Println("Serving on port 4444")