1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 02:19:22 +02:00

new router recognizer

This commit is contained in:
Nikolay Kim
2017-10-16 19:21:24 -07:00
parent 35107f64e7
commit f59f68eded
10 changed files with 229 additions and 42 deletions

View File

@ -18,6 +18,7 @@ impl Route for MyRoute {
type State = ();
fn request(req: HttpRequest, payload: Payload, ctx: &mut HttpContext<Self>) -> Reply<Self> {
println!("PARAMS: {:?} {:?}", req.match_info().get("name"), req.match_info());
if !payload.eof() {
ctx.add_stream(payload);
Reply::stream(MyRoute{req: Some(req)})
@ -105,7 +106,7 @@ fn main() {
HttpServer::new(
RoutingMap::default()
.app("/blah", Application::default()
.resource("/test", |r| {
.resource("/test/{name}", |r| {
r.get::<MyRoute>();
r.post::<MyRoute>();
})