actix_web::web

Function to

source
pub fn to<F, Args>(handler: F) -> Route
where F: Handler<Args>, Args: FromRequest + 'static, F::Output: Responder + '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))
);