spa

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

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

func NewHandler(logger logging.Logger, staticDir string) http.Handler

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL