1
0
forked from rosa/hakurei
Files
hakurei/cmd/mbf/internal/pkgserver/ui/ui.go

22 lines
439 B
Go

// Package ui holds the static web UI.
package ui
import (
"io/fs"
"net/http"
)
// staticFS is an internal helper to wrap around go:embed's filesystem.
func staticFS(static fs.FS) fs.FS {
if f, err := fs.Sub(static, "static"); err != nil {
panic(err)
} else {
return f
}
}
// Register arranges for mux to serve the embedded frontend.
func Register(mux *http.ServeMux) {
mux.Handle("GET /", http.FileServer(http.FS(static)))
}