1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 15:39:02 +02:00

Quick pass at url-dispatch

This commit is contained in:
Cameron Dershem
2019-06-17 02:08:42 -04:00
parent a313315a92
commit 0c268d18c1
15 changed files with 93 additions and 95 deletions

View File

@ -1,16 +1,15 @@
// <resource>
use actix_web::{http::Method, App, HttpRequest, HttpResponse};
use actix_web::{http::Method, web, App, HttpRequest, HttpResponse};
fn index(req: &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();
.service(web::resource("/prefix").route(web::get().to(index)))
.service(
web::resource("/user/{name}").route(web::get().to(|| HttpResponse::Ok())),
);
}
// </resource>