Skip to main content

serve

Function serve 

Source
pub async fn serve(config: ServerConfig) -> Result<(), ServerError>
Expand description

Bind and start the HTTP server, shutting down gracefully on SIGINT/SIGTERM.

Delegates binding to bind, installs the Prometheus metrics recorder globally, then spawns an upkeep task that is aborted when the server future completes. Logs the actual bound address using TcpListener::local_addr rather than the configured port, so that port 0 (OS-assigned) shows the real port.

ยงErrors

Returns Err if the Prometheus recorder cannot be installed, the host cannot be resolved, the port is already in use, or listening fails.