Skip to main content

Module http_server

Module http_server 

Source
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.
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.