Function axum::handler::any[][src]

pub fn any<H, B, T>(handler: H) -> OnMethod<H, B, T, EmptyRouter> where
    H: Handler<B, T>, 
Expand description

Route requests with any standard HTTP method to the given handler.

Example

use axum::{
    handler::any,
    Router,
};

async fn handler() {}

let app = Router::new().route("/", any(handler));

Note that this only accepts the standard HTTP methods. If you need to support non-standard methods use Handler::into_service:

use axum::{
    handler::Handler,
    Router,
};

async fn handler() {}

let app = Router::new().route("/", handler.into_service());