Rename htmlpage to html
Because it's going to get more tools.
This commit is contained in:
parent
2bd848fa97
commit
9b1d75d47f
44 changed files with 83 additions and 77 deletions
22
html/static.go
Normal file
22
html/static.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue