Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSinglePageAppHandler ¶
NewSinglePageAppHandler returns an HTTP handler for serving a single-page application.
In regular builds, the handler serves files from the provided embedFs, which generally should be an embed.FS. In debug builds (activated via the -tags debug flag), it attempts to locate and serve static assets from the file system using the provided embedPath.
Parameters:
- embedFs: an fs.FS providing the embedded static assets.
- embedPath: a relative file path to the static assets, used only in debug mode.
Returns:
- http.Handler: a handler that serves static files if they exist, or falls back to serving the root file (typically index.html) when a file is not found.
- error: an error value if the handler cannot be instantiated in debug mode; nil otherwise.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.