Documentation
¶
Overview ¶
Package wholestack composes a GoWebComponents app into a single http.Handler — the one-binary, whole-stack, edge-portable deployment (FC5). One `go build` produces an executable that serves the embedded wasm bundle (index.html, the .wasm, wasm_exec.js) AND the app's //gwc:server functions, with SPA fallback so client-routed paths resolve to the shell. No Node, no separate static host, no reverse proxy — the binary is the app, and it runs anywhere Go's net/http runs, including edge runtimes.
Index ¶
Constants ¶
const ServerFnPrefix = serverfn.RoutePrefix
ServerFnPrefix re-exports the path server functions are mounted under.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler builds the single http.Handler that is the whole app: server functions under serverfn.RoutePrefix, static assets everywhere else, and (unless disabled) an SPA fallback to the index shell for client-routed paths.
func ListenAndServe ¶
ListenAndServe builds the whole-stack handler and serves it on addr — the one-line production entry point for a single-binary app.
Types ¶
type Options ¶
type Options struct {
// Assets is the filesystem of built client assets (commonly an embed.FS sub-tree). It
// must contain IndexFile at its root.
Assets fs.FS
// RegisterServerFns wires the app's //gwc:server functions onto the mux (typically the
// generated RegisterServerFunctions). May be nil for a static-only app.
RegisterServerFns func(*http.ServeMux)
// IndexFile is the SPA shell served at "/" and as the fallback for unknown paths.
// Defaults to "index.html".
IndexFile string
// DisableSPAFallback turns off serving the index shell for unknown, non-asset GETs.
// The default (false) keeps SPA fallback ON so client-side routes deep-link correctly.
DisableSPAFallback bool
}
Options configures the whole-stack handler.