1
0
mirror of https://github.com/actix/actix-website synced 2024-12-04 20:51:54 +01:00
actix-website/examples/url-dispatch/src/dhandler.rs

18 lines
429 B
Rust
Raw Normal View History

2019-06-17 08:08:42 +02:00
use actix_web::{guard, web, App, HttpRequest, HttpResponse, Responder};
fn index(_req: HttpRequest) -> impl Responder {
"Welcome!"
}
2018-05-24 19:13:55 +02:00
2019-06-17 08:08:42 +02:00
// <default>
2018-05-24 19:13:55 +02:00
fn main() {
App::new()
2019-06-17 08:08:42 +02:00
.service(web::resource("/").route(web::get().to(index)))
.default_service(
web::route()
.guard(guard::Not(guard::Get()))
.to(|| HttpResponse::MethodNotAllowed()),
);
2018-05-24 19:13:55 +02:00
}
// </default>