mirror of https://github.com/fafhrd91/actix-web
Update documentation for App::default_service to match reality.
This commit is contained in:
parent
cc9ba162f7
commit
a6f479a6fa
17
src/app.rs
17
src/app.rs
|
@ -236,9 +236,9 @@ where
|
|||
self
|
||||
}
|
||||
|
||||
/// Default service to be used if no matching resource could be found.
|
||||
/// Default service that is invoked when no matching resource could be found.
|
||||
///
|
||||
/// It is possible to use services like `Resource`, `Route`.
|
||||
/// You must use a [`Route`] as default service:
|
||||
///
|
||||
/// ```
|
||||
/// use actix_web::{web, App, HttpResponse};
|
||||
|
@ -253,19 +253,6 @@ where
|
|||
/// .default_service(
|
||||
/// web::route().to(|| HttpResponse::NotFound()));
|
||||
/// ```
|
||||
///
|
||||
/// It is also possible to use static files as default service.
|
||||
///
|
||||
/// ```
|
||||
/// use actix_web::{web, App, HttpResponse};
|
||||
///
|
||||
/// let app = App::new()
|
||||
/// .service(
|
||||
/// web::resource("/index.html").to(|| HttpResponse::Ok()))
|
||||
/// .default_service(
|
||||
/// web::to(|| HttpResponse::NotFound())
|
||||
/// );
|
||||
/// ```
|
||||
pub fn default_service<F, U>(mut self, svc: F) -> Self
|
||||
where
|
||||
F: IntoServiceFactory<U, ServiceRequest>,
|
||||
|
|
Loading…
Reference in New Issue