Skip to main content

Module http_server

Module http_server 

Source
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.
HttpServer
High-performance HTTP server built on axum.
HttpServerConfig
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§

HttpServerError
Errors that can occur when running the HTTP server.

Traits§

IntoResponse
Trait for generating responses.

Functions§

delete
Route DELETE requests to the given handler.
get
Route GET requests to the given handler.
post
Route POST requests to the given handler.
put
Route PUT requests to the given handler.

Type Aliases§

Response
Type alias for http::Response whose body type defaults to Body, the most common body type used with axum.
Result
Result type for HTTP server operations.