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