ohttp-gateway 0.2.0

A OHTTP Gateway server, meant to run between a OHTTP Relay and a target web service.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Additional metrics middleware if needed
use crate::state::AppState;
use axum::{body::Body, extract::Request, extract::State, middleware::Next, response::Response};

pub async fn metrics_middleware(
    State(state): State<AppState>,
    request: Request<Body>,
    next: Next,
) -> Response {
    state.metrics.active_connections.inc();

    let response = next.run(request).await;

    state.metrics.active_connections.dec();

    response
}