Documentation
¶
Overview ¶
Package httpserver contains the shared Gin HTTP server used by both the desktop (main) and mobile entry points. Callers configure behaviour via Options and get back a *gin.Engine ready to be Run on any net.Listener.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MddFileHandler ¶
MddFileHandler serves a single MDD resource (audio/image) on demand. Register it as NoRoute to handle <img src="/..."> and <audio src="/...">.
func QueryDefinition ¶
QueryDefinition is exported so main.go can call it for the CLI one-shot mode.
Types ¶
type DefinitionMatchView ¶
DefinitionMatchView is a single definition search result for the template.
type Options ¶
type Options struct {
// History is used to record queries. May be nil (disables recording).
History *history.History
// EnableAuth adds /login, /auth, and /review routes with session middleware.
EnableAuth bool
// AuthSetup is called after the gin.Engine is created so the caller can
// attach session middleware and auth route handlers. Only called when
// EnableAuth is true.
AuthSetup func(r *gin.Engine)
// Middleware is applied globally before any routes are registered.
Middleware []gin.HandlerFunc
// ResourceHandler is registered as NoRoute to serve static assets
// (audio, images) on unmatched paths. If nil, no NoRoute is registered
// and the caller is responsible for serving assets (e.g. via static middleware).
ResourceHandler gin.HandlerFunc
}
Options configures the HTTP server.
Click to show internal directories.
Click to hide internal directories.