server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package server exposes the CMS core over a JSON HTTP API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(cfg Config) http.Handler

NewServer returns the HTTP handler serving the CMS API. Every route requires a login session except login, logout, and each plugin's declared public paths.

Types

type Config

type Config struct {
	Users authkit.AdminStore
	// Posts persists the content the CMS serves.
	Posts post.Store
	// Plugins maps a plugin id to its HTTP handler.
	Plugins map[string]http.Handler
	// PluginPublicPaths maps a plugin id to its session-exempt paths.
	PluginPublicPaths map[string][]string
	// Web serves the single-page app under the admin base path. Nil leaves the admin paths unhandled.
	Web fs.FS
	// SiteTitle names the public site in its chrome.
	SiteTitle string
	// TrustedProxies lists the CIDR ranges trusted to set X-Forwarded-For.
	TrustedProxies []string
	// Theme serves the public site while it is healthy. Nil leaves the built-in renderer serving.
	Theme Theme
	// ThemeTimeout is how long a theme has to begin answering. Zero applies the default.
	ThemeTimeout time.Duration
	// Version is the application version reported at /api/version.
	Version string
}

Config carries the stores and plugin surfaces the server serves.

type Theme

type Theme interface {
	// Healthy reports whether the theme is serving.
	Healthy() bool
	// Target returns the address the theme serves on.
	Target() string
}

Theme is the running theme the public site is served through.

Jump to

Keyboard shortcuts

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