1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

Allow to use any service as default service

This commit is contained in:
Nikolay Kim
2019-04-13 22:25:00 -07:00
parent 32ac159ba2
commit 5bd5651faa
7 changed files with 87 additions and 30 deletions

View File

@ -36,9 +36,9 @@ fn main() -> std::io::Result<()> {
.wrap(
middleware::DefaultHeaders::new().header("X-Version-R2", "0.3"),
)
.default_resource(|r| {
r.route(web::route().to(|| HttpResponse::MethodNotAllowed()))
})
.default_service(
web::route().to(|| HttpResponse::MethodNotAllowed()),
)
.route(web::get().to_async(index_async)),
)
.service(web::resource("/test1.html").to(|| "Test\r\n"))