Available on crate feature
http-server only.Expand description
HTTP server built on axum. Compatible with Tonic for gRPC.
§Features
- Graceful shutdown
- Configurable request timeout, in-flight cap, Tower middleware
- Health endpoints (
/healthz,/readyz, plus/health/*aliases)
In-process TLS and a /metrics endpoint are NOT wired here – see
HttpServerConfig. Terminate TLS at the ingress / mesh; metrics are
served by MetricsManager on its own listener.
§Example
use hyperi_rustlib::http_server::{HttpServer, HttpServerConfig};
use axum::{Router, routing::get};
let config = HttpServerConfig {
bind_address: "0.0.0.0:8080".to_string(),
..Default::default()
};
let app = Router::new()
.route("/", get(|| async { "Hello, World!" }));
let server = HttpServer::new(config);
server.serve(app).await?;Structs§
- Extension
- Extractor and response for extensions.
- Http
Server - High-performance HTTP server built on axum.
- Http
Server Config - HTTP server configuration.
- Json
- JSON Extractor / Response.
- Path
- Extractor that will get captures from the URL and parse them using
serde. - Query
- Extractor that deserializes query strings into some type.
- Router
- The router type for composing handlers and services.
- State
- Extractor for state.
Enums§
- Http
Server Error - Errors that can occur when running the HTTP server.
Traits§
- Into
Response - Trait for generating responses.
Functions§
- delete
- Route
DELETErequests to the given handler. - get
- Route
GETrequests to the given handler. - post
- Route
POSTrequests to the given handler. - put
- Route
PUTrequests to the given handler.
Type Aliases§
- Response
- Type alias for
http::Responsewhose body type defaults toBody, the most common body type used with axum. - Result
- Result type for HTTP server operations.