[−][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, Error, HttpResponse}; async fn my_service(req: dev::ServiceRequest) -> Result<dev::ServiceResponse, Error> { Ok(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) ); }