22 lines
362 B
Go
22 lines
362 B
Go
package html
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
//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")
|
|
}
|