Function ajars_actix_web::actix_web::web::to [−][src]
pub fn to<F, I, R>(handler: F) -> Route where
I: FromRequest + 'static,
R: Future + 'static,
F: Handler<I, R>,
<R as Future>::Output: Responder,
<R as Future>::Output: 'static,
Expand description
Create a new route and add handler.
use actix_web::{web, App, HttpResponse, Responder}; async fn index() -> impl Responder { HttpResponse::Ok() } App::new().service( web::resource("/").route( web::to(index)) );