Documentation
¶
Overview ¶
Package cmd serves the web UI, and its configuration, alongside the API, when the server is built with the "frontend" tag, which embeds the UI, once it's built, with npm, into build/frontend, which make does. Without it, such as with go install, the server serves the API, without the UI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Prefix string `json:"prefix" help:"Path prefix of the API, such as /api"`
Version string `json:"version,omitempty" help:"Version of the server"`
OpenAPI string `json:"openapi,omitempty" help:"Path of the API's documentation, when it's served"`
}
Config is the configuration of the web UI, which it reads from /config.json
type Flags ¶
type Flags struct {
UI bool `name:"ui" help:"Serve the web UI from this server, when it's built in." default:"true" negatable:""`
}
Flags are the web UI's flags
func (*Flags) RegisterUI ¶
func (f *Flags) RegisterUI(ctx context.Context, log *slog.Logger, router *httprouter.Router, openapi bool) error
RegisterUI registers the web UI, when it's built in, and its configuration, unless the UI isn't to be served. When openapi is set, the server serves the API's documentation, at {prefix}/openapi.html, which the UI links to.