aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-27 06:36:27 +0000
committerFuwn <[email protected]>2022-03-27 06:36:27 +0000
commit78f91618b391d9db9de0a075d2d86c950d215dbd (patch)
treeb59c0b98bb832fe89aba2c785d3610b1fb7fe2ed
parentfeat(cargo): bump version to 0.1.0 (diff)
downloadwindmark-78f91618b391d9db9de0a075d2d86c950d215dbd.tar.xz
windmark-78f91618b391d9db9de0a075d2d86c950d215dbd.zip
docs(readme): fix example
-rw-r--r--README.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index 0c303c6..b0f8362 100644
--- a/README.md
+++ b/README.md
@@ -23,15 +23,17 @@ windmark = "0.1.0"
### Implement a Windmark server
```rust
-use windmark::response::Response;
+use windmark::Response;
-fn main() -> std::io::Result<()> {
+#[windmark::main]
+fn main() -> Result<(), Box<dyn std::error::Error>> {
windmark::Router::new()
- .mount("/", |_, _, _| Response::Success("Hello, World!".into()))
- .set_error_handler(|_, _, _| {
+ .mount("/", |_| Response::Success("Hello, World!".into()))
+ .set_error_handler(|_| {
Response::PermanentFailure("This route does not exist!".into())
})
.run()
+ .await
}
```