[][src]Function ntex::web::to

pub fn to<F, Args, Err>(handler: F) -> Route<Err> where
    F: Handler<Args, Err>,
    Args: FromRequest<Err> + 'static,
    Err: ErrorRenderer,
    Err::Container: From<Args::Error>,
    <F::Output as Responder<Err>>::Error: Into<Err::Container>, 

Create a new route and add handler.

use ntex::web;

async fn index() -> web::HttpResponse {
   web::HttpResponse::Ok().finish()
}

web::App::new().service(
    web::resource("/").route(web::to(index))
);