diff --git a/main.go b/main.go index 1ce0d22..9009402 100644 --- a/main.go +++ b/main.go @@ -1,14 +1,14 @@ package main import ( - _ "embed" + "embed" "io" "log" "net/http" ) -//go:embed index.html -var index []byte +//go:embed index.html style.css +var staticfiles embed.FS func main() { http.HandleFunc("GET /containers", func(w http.ResponseWriter, r *http.Request) { @@ -20,9 +20,7 @@ func main() { } }) - http.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) { - w.Write(index) - }) + http.Handle("GET /", http.FileServer(http.FS(staticfiles))) log.Fatal(http.ListenAndServe(":8080", nil)) }