Documentation
¶
Overview ¶
Package ui provides an embedded SPA file server for the Sparrow web frontend.
The static build output from web/build/ is embedded at compile time. When SPARROW_SERVE_UI=true, the Go binary serves the frontend on the same port as the Connect-RPC API. Chi router ensures API routes always take precedence; the UI handler is registered as the NotFound fallback.
Build the frontend first:
cd web && npm run build:static cd .. && go build ./cmd/server
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Available ¶
func Available() bool
Available reports whether the embedded UI contains a built frontend. Returns false if only the placeholder .gitkeep exists.
func Handler ¶
Handler returns an http.Handler that serves the embedded SPA. It serves static files from the embedded filesystem, and falls back to index.html for any path that doesn't match a static file (SPA client-side routing).
The config parameter is injected into index.html as a window.__SPARROW_CONFIG__ global so the SPA can read runtime configuration without a rebuild.