Documentation
¶
Overview ¶
Package api is the composition root's one dependency: an http.Handler satisfying api/openapi.yaml, serving the aggregated dashboard snapshot and the static frontend. It lives under internal/ because the API this service offers is its endpoints, not its Go packages — see go.md's "a server keeps everything in internal/ and its commands in cmd/".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMux ¶
func NewMux(getSnapshot func() dashboard.Snapshot, authService *auth.Service, authStore *auth.Store) *http.ServeMux
NewMux wires the handlers registered against api/openapi.yaml: liveness, passkey registration/login/session, the aggregated dashboard snapshot, and the static frontend that consumes it. getSnapshot is called fresh on every request, so a request always sees whatever the aggregator most recently assembled — typically (*dashboard.Aggregator).Get.
The dashboard itself, and the page that renders it, require a valid session; registration, login and the handful of static assets a login page needs (its own HTML/JS, the shared stylesheet, the favicon) don't.
Types ¶
type Health ¶
type Health struct {
Status string `json:"status"`
}
Health matches components.schemas.Health in api/openapi.yaml.
type SessionUser ¶ added in v0.7.0
type SessionUser struct {
Username string `json:"username"`
DisplayName string `json:"displayName"`
IsAdmin bool `json:"isAdmin"`
}
SessionUser matches components.schemas.SessionUser in api/openapi.yaml.