Function actix_web::web::to [−][src]
pub fn to<F, I, R>(handler: F) -> Route where
F: Handler<I, R>,
I: FromRequest + 'static,
R: Future + 'static,
R::Output: Responder + '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)) );