[][src]Function actix_web::web::service

pub fn service(path: &str) -> WebService

Create raw service for a specific path.

use actix_web::{dev, web, guard, App, HttpResponse};

fn my_service(req: dev::ServiceRequest) -> dev::ServiceResponse {
    req.into_response(HttpResponse::Ok().finish())
}

fn main() {
    let app = App::new().service(
        web::service("/users/*")
            .guard(guard::Header("content-type", "text/plain"))
            .finish(my_service)
    );
}