Available on crate feature
http-server only.Expand description
High-performance HTTP server built on axum.
This module provides a configurable HTTP server suitable for building APIs, health endpoints, and metrics servers. It uses axum for ergonomics and is compatible with Tonic for gRPC.
§Features
- Graceful shutdown support
- Configurable timeouts (request, keep-alive)
- Optional TLS support
- Health check endpoints (
/health/live,/health/ready) - Metrics endpoint (
/metrics) - Tower middleware integration
§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.