fixed embeded static files

This commit is contained in:
Djeeberjr 2021-11-22 02:26:08 +01:00
parent c5ab0156fd
commit 2353a0bf53

View File

@ -5,6 +5,7 @@ package httpserver
import ( import (
"embed" "embed"
"github.com/gorilla/mux"
"io/fs" "io/fs"
"net/http" "net/http"
"os" "os"
@ -26,7 +27,7 @@ func (spa *spaFileSystem) Open(name string) (http.File, error) {
return f, err return f, err
} }
func initStatic(e *mux.Router) { func initStatic(r *mux.Router) {
staticFS, _ := fs.Sub(staticFiles, "static") staticFS, _ := fs.Sub(staticFiles, "static")
r.Handle("/", http.FileServer(&spaFileSystem{http.FS(staticFS)})) r.PathPrefix("/").Handler(http.FileServer(&spaFileSystem{http.FS(staticFS)}))
} }