web

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package web serves embedded single-page applications with optional Go-template index data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SPA

type SPA struct {
	// Assets is rooted at the web distribution directory, unless Index names a subdirectory.
	Assets fs.FS
	// Index defaults to index.html; its directory also locates public static files.
	Index string
	// BasePath is the URL mount prefix, for example /motus/.
	BasePath string
	// TemplateData provides optional extra values for index.html.
	TemplateData map[string]any
}

SPA describes a frontend build and its externally mounted base path.

func (SPA) Handler

func (s SPA) Handler() http.Handler

Handler serves public static files and falls back to index for browser navigation. Missing files and unsafe paths never fall back to index.html.

Jump to

Keyboard shortcuts

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