[][src]Function ntex::web::method

pub fn method<Err: ErrorRenderer>(method: Method) -> Route<Err>

Create route and add method guard.

use ntex::web;

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

In the above example, one GET route gets added:

  • /{project_id}