Compare commits

..

1 Commits

Author SHA1 Message Date
2353a0bf53 fixed embeded static files 2021-11-22 02:26:08 +01:00

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