From 2353a0bf53cff579ac560a9ad16488a0c2067516 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 22 Nov 2021 02:26:08 +0100 Subject: [PATCH] fixed embeded static files --- internal/httpserver/staticFiles.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/httpserver/staticFiles.go b/internal/httpserver/staticFiles.go index f2c9a92..8fa817b 100644 --- a/internal/httpserver/staticFiles.go +++ b/internal/httpserver/staticFiles.go @@ -5,6 +5,7 @@ package httpserver import ( "embed" + "github.com/gorilla/mux" "io/fs" "net/http" "os" @@ -26,7 +27,7 @@ func (spa *spaFileSystem) Open(name string) (http.File, error) { return f, err } -func initStatic(e *mux.Router) { +func initStatic(r *mux.Router) { staticFS, _ := fs.Sub(staticFiles, "static") - r.Handle("/", http.FileServer(&spaFileSystem{http.FS(staticFS)})) + r.PathPrefix("/").Handler(http.FileServer(&spaFileSystem{http.FS(staticFS)})) }