From 6f5b2708d5654f9d42eca4b697feee233c771fa5 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 31 May 2021 16:32:56 +0200 Subject: [PATCH] A few more changes --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 78d17add..b00fa977 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,17 @@ async fn handler( } ``` +The inputs can also be optional: + +```rust +async fn handler( + req: Request, + user: Option>, +) -> Result<&'static str, Error> { + // ... +} +``` + You can also get the raw response body: ```rust @@ -125,7 +136,11 @@ pub trait FromRequest: Sized { } ``` -This "extractor" pattern is inspired by Bevy's ECS. +This "extractor" pattern is inspired by Bevy's ECS. The idea is that it should +be easy to parse pick apart the request without having to repeat yourself a lot +or use macros. + +Dynamic routes like `GET /users/:id` is also supported. You can also return different response types: