Function ntex::web::to [−][src]
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>,
Expand description
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))
);