nidus-sync/html/static.go

21 lines
324 B
Go
Raw Normal View History

package html
import (
"embed"
"net/http"
"github.com/go-chi/chi/v5"
)
//go:embed static/*
var EmbeddedStaticFS embed.FS
var localFS http.Dir
func AddStaticRoute(r chi.Router, path string) {
if localFS == "" {
localFS = http.Dir("./html/static")
}
FileServer(r, "/static", localFS, EmbeddedStaticFS, "static")
}