paperclip_actix::web

Function to

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