mirror of
https://github.com/actix/actix-website
synced 2025-06-27 15:39:02 +02:00
update url-dispatch examples
This commit is contained in:
14
examples/url-dispatch/src/dhandler.rs
Normal file
14
examples/url-dispatch/src/dhandler.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// <default>
|
||||
use actix_web::{http::Method, pred, App, HttpResponse};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.default_resource(|r| {
|
||||
r.method(Method::GET).f(|req| HttpResponse::NotFound());
|
||||
r.route()
|
||||
.filter(pred::Not(pred::Get()))
|
||||
.f(|req| HttpResponse::MethodNotAllowed());
|
||||
})
|
||||
.finish();
|
||||
}
|
||||
// </default>
|
Reference in New Issue
Block a user