Skip to main content

fallback_404

Function fallback_404 

Source
pub async fn fallback_404() -> Response
Expand description

Fallback handler for routes that do not match any registered route.

Returns a 404 JSON response: {"error": "not found", "status": 404}.

Use with axum::Router::fallback:

use aro_web::fallback::fallback_404;
use axum::Router;
use axum::routing::get;

let _app: Router = Router::new()
    .route("/users", get(|| async { "ok" }))
    .fallback(fallback_404);