Skip to main content

Module server

Module server 

Source
Expand description

HTTP server startup and graceful shutdown.

This module provides:

§Example

use modo::server::{Config, http};

#[tokio::main]
async fn main() -> modo::Result<()> {
    let config = Config::default();
    let router = modo::axum::Router::new();
    let server = http(router, &config).await?;
    modo::run!(server).await
}

Structs§

Config
HTTP server configuration.
HostRouter
Routes requests to different axum Routers based on the Host header.
HttpServer
An opaque handle to the running HTTP server.
MatchedHost
Information about a wildcard host match.

Functions§

http
Bind a TCP listener and start serving router.