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:
16
examples/url-dispatch/src/resource.rs
Normal file
16
examples/url-dispatch/src/resource.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// <resource>
|
||||
use actix_web::{http::Method, App, HttpRequest, HttpResponse};
|
||||
|
||||
fn index(req: HttpRequest) -> HttpResponse {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.resource("/prefix", |r| r.f(index))
|
||||
.resource("/user/{name}", |r| {
|
||||
r.method(Method::GET).f(|req| HttpResponse::Ok())
|
||||
})
|
||||
.finish();
|
||||
}
|
||||
// </resource>
|
Reference in New Issue
Block a user