rustapi_core/middleware/
mod.rs

1//! Middleware infrastructure for RustAPI
2//!
3//! This module provides Tower-compatible middleware support for RustAPI applications.
4//! Middleware can be added using the `.layer()` method on `RustApi`.
5//!
6//! # Example
7//!
8//! ```rust,ignore
9//! use rustapi_rs::prelude::*;
10//! use rustapi_core::middleware::RequestIdLayer;
11//!
12//! RustApi::new()
13//!     .layer(RequestIdLayer::new())
14//!     .route("/", get(handler))
15//!     .run("127.0.0.1:8080")
16//!     .await
17//! ```
18
19mod body_limit;
20mod layer;
21#[cfg(feature = "metrics")]
22mod metrics;
23mod request_id;
24mod tracing_layer;
25
26pub use body_limit::{BodyLimitLayer, DEFAULT_BODY_LIMIT};
27pub use layer::{BoxedNext, LayerStack, MiddlewareLayer};
28#[cfg(feature = "metrics")]
29pub use metrics::{MetricsLayer, MetricsResponse};
30pub use request_id::{RequestId, RequestIdLayer};
31pub use tracing_layer::TracingLayer;