Skip to main content

not_found_handler

Function not_found_handler 

Source
pub async fn not_found_handler() -> Response<Body>
Expand description

Axum handler function that returns 404 Not Found with a Twirp JSON payload.

axum::Router’s default fallback handler returns a 404 Not Found with no body content. Use this fallback instead for full Twirp compliance.

§Usage

use axum::Router;

let app = Router::new()
    .nest("/twirp", twirp_routes)
    .fallback(twirp::server::not_found_handler);