pub fn to<F, I, R>(handler: F) -> Route where
F: Handler<I, R>,
I: FromRequest + 'static,
R: Future + 'static,
R::Output: Responder + 'static,
<R::Output as Responder>::Body: MessageBody + 'static,
<<R::Output as Responder>::Body as MessageBody>::Error: Into<Box<dyn StdError + 'static>>,
Expand description
Creates a new any-method route with handler.
use actix_web::{web, App, HttpResponse, Responder};
async fn index() -> impl Responder {
HttpResponse::Ok()
}
App::new().service(
web::resource("/").route(
web::to(index))
);