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.
- Frontend
Params - 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.
- WebServer
State - Everything a handler can reach: the server’s configuration and kits, plus
the application’s state as
S. - Well
Known - The well-known documents a frontend serves, held in memory.
Enums§
- WebServer
Error - 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_PORTis 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
bodywith observability, a runtime, and signal handling set up.