Expand description
§modo::server
HTTP server startup, host-based routing, and graceful shutdown.
Provides:
Config— bind address and shutdown timeout, loaded from YAML.http()— binds a TCP listener and returns anHttpServerhandle.HttpServer— opaque server handle that implementscrate::runtime::Taskfor use with thecrate::run!macro.HostRouter— routes requests to different axum routers byHostheader; supports exact matches and single-level wildcard subdomains.MatchedHost— axum extractor for the subdomain captured by a wildcardHostRouterpattern.
§Quick start
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.
- Host
Router - Routes requests to different axum
Routers based on theHostheader. - Http
Server - An opaque handle to the running HTTP server.
- Matched
Host - Information about a wildcard host match.
Functions§
- http
- Bind a TCP listener and start serving
router.