logo
pub fn method(method: Method) -> Route
Expand description

Creates a new route with specified method guard.

Examples

In this example, one GET /{project_id} route is set up:

use actix_web::{web, http, App, HttpResponse};

let app = App::new().service(
    web::resource("/{project_id}")
        .route(web::method(http::Method::GET).to(|| HttpResponse::Ok()))
);