Function ntex::web::service [−][src]
pub fn service<T: IntoPattern>(path: T) -> WebServiceAdapter
Expand description
Create service adapter for a specific path.
use ntex::web::{self, dev, guard, App, HttpResponse, Error, DefaultError}; async fn my_service(req: dev::WebRequest<DefaultError>) -> Result<dev::WebResponse, Error> { Ok(req.into_response(HttpResponse::Ok().finish())) } let app = App::new().service( web::service("/users/*") .guard(guard::Header("content-type", "text/plain")) .finish(my_service) );