Documentation
¶
Overview ¶
Package spa provides the HTTP handler that serves a single-page application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler returns an http.Handler that serves static files from staticDir.
A path that resolves to a file on disk is served directly, with a Cache-Control header chosen from its name (see [cacheControl]). A path that does not resolve to a file follows the SPA routing contract: a browser navigation receives index.html so the client-side router can handle the route, while a request for a missing asset (a path with a file extension, or a non-HTML client) receives 404 — so a misconfigured deploy fails loudly at the first request instead of returning index.html as JavaScript ("Unexpected token '<'").
Types ¶
This section is empty.