Function axum::routing::handler_method_routing::get[][src]

pub fn get<H, B, T>(handler: H) -> MethodRouter<H, B, T, MethodNotAllowed> where
    H: Handler<B, T>, 
Expand description

Route GET requests to the given handler.

Example

use axum::{
    routing::get,
    Router,
};

async fn handler() {}

// Requests to `GET /` will go to `handler`.
let app = Router::new().route("/", get(handler));

Note that get routes will also be called for HEAD requests but will have the response body removed. Make sure to add explicit HEAD routes afterwards.