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