statics use fs.FS

This commit is contained in:
kenneth 2025-06-12 10:49:14 +08:00
parent 8bdf9e9b57
commit 3150ba80bc

View File

@ -8,6 +8,7 @@ import (
v1 "management/internal/erpserver/service/v1"
mi "management/internal/pkg/middleware"
"management/internal/pkg/session"
static "management/web/statics"
"github.com/drhin/logger"
"github.com/go-chi/chi/v5"
@ -37,7 +38,8 @@ func NewHTTPServer(
// r.Use(middleware.Logger)
r.Use(middleware.Recoverer)
staticServer := http.FileServer(http.Dir("./web/statics/"))
//staticServer := http.FileServer(http.Dir("./web/statics/"))
staticServer := http.FileServer(http.FS(static.StaticFS))
r.Handle("/statics/*", http.StripPrefix("/statics", staticServer))
uploadServer := http.FileServer(http.Dir("./public/"))