24 lines
617 B
Go
24 lines
617 B
Go
package api
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
// The DriverVault API panel: a Vue 3 + Tailwind app (source in panel/, built with
|
|
// `npm run build` into internal/api/dist) embedded at compile time and served
|
|
// at the server root. It shows a live health status and the REST reference.
|
|
//
|
|
//go:embed all:dist
|
|
var panelFS embed.FS
|
|
|
|
// panelHandler serves the built panel assets from the embedded dist directory.
|
|
func panelHandler() http.Handler {
|
|
sub, err := fs.Sub(panelFS, "dist")
|
|
if err != nil {
|
|
panic(err) // embedded dist is malformed; unreachable in a valid build
|
|
}
|
|
return http.FileServerFS(sub)
|
|
}
|