Skip to main content

Module webserver

Module webserver 

Source
Expand description

The web server: builder, shared state, bootstrap, graceful shutdown.

The application owns main. [bootstrap] sets up the things that are process-global and easy to order wrongly — error monitoring, the runtime, signal handling — and hands back a Shutdown handle. Everything after that is ordinary code, so one binary can run several WebServers on different ports and drain them together.

Structs§

Frontend
A frontend, assembled.
FrontendParams
Everything a frontend requires.
Pages
The pages a site serves.
Shutdown
A cloneable handle that resolves when the process should stop.
WebServer
An HTTP server.
WebServerState
Everything a handler can reach: the server’s configuration and kits, plus the application’s state as S.
WellKnown
The well-known documents a frontend serves, held in memory.

Enums§

WebServerError
Every way the web server can fail.

Constants§

API_PREFIX
The prefix every built-in endpoint is nested under.
DEFAULT_BODY_LIMIT
The request body ceiling used when none is set.
DEFAULT_DRAIN_TIMEOUT
The longest in-flight work may take once shutdown begins.
DEFAULT_PORT
The port used when ENV_PORT is unset.
ENV_HOST
The environment variable holding the bind host.
ENV_PORT
The environment variable holding the bind port.

Traits§

AppShutdown
Application cleanup that must finish before the process exits.

Functions§

bootstrap_with_release
Runs body with observability, a runtime, and signal handling set up.