fixed embeded static files
This commit is contained in:
parent
c5ab0156fd
commit
2353a0bf53
@ -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)}))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user