go-tools/app/root/root.go

28 lines
384 B
Go
Raw Normal View History

2023-07-15 08:35:45 -06:00
package root
import (
"embed"
"io/fs"
"net/http"
"go.sour.is/pkg/lg"
)
var (
//go:embed assets/*
files embed.FS
)
type root struct{}
func New() *root {
return &root{}
}
func (s *root) RegisterHTTP(mux *http.ServeMux) {
a, _ := fs.Sub(files, "assets")
assets := http.StripPrefix("/", http.FileServer(http.FS(a)))
mux.Handle("/", lg.Htrace(assets, "mailadm-assets"))
}