Help us shape the future of Go! Take the 2026 Go Developer Survey

web

package
v2.4.18 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package web serves the compiled Next.js export of the Cortex web UI from inside the Go binary. It is a local-safe package: it depends only on the standard library and the local web-key verifier, never on PostgreSQL, authz, or the server composition root.

Index

Constants

View Source
const (
	// HealthPath is the unauthenticated readiness probe the web shell calls.
	HealthPath = "/health"
	// ConfigScriptPath serves the runtime endpoint configuration script.
	ConfigScriptPath = "/config.js"
	// APIPrefix is reserved for the API mux; the web handler never answers it.
	APIPrefix = "/api/"
)

Variables

This section is empty.

Functions

func Assets

func Assets() fs.FS

Assets returns the read-only filesystem backing the embedded web export. It always contains at least the committed placeholder document, so callers can rely on it even when the web toolchain never ran in a checkout.

func NewHandler

func NewHandler(cfg Config, verifier webkey.Verifier) http.Handler

NewHandler builds the embedded web surface. verifier gates the surface via the web-key credential; nil disables the guard (web surface mounted without a key).

Types

type Config

type Config struct {
	// ServerURL is the API origin injected as
	// window.__CORTEX_WEB_CONFIG__.serverUrl. When empty the generated script
	// resolves the page origin at load time, keeping the default same-origin.
	ServerURL string

	// Assets overrides the embedded export filesystem. Nil selects the
	// compiled-in dist tree; tests and alternate compositions may substitute one.
	Assets fs.FS
}

Config controls the embedded web handler.

Jump to

Keyboard shortcuts

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