diff options
| author | Fuwn <[email protected]> | 2022-03-27 06:36:27 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-27 06:36:27 +0000 |
| commit | 78f91618b391d9db9de0a075d2d86c950d215dbd (patch) | |
| tree | b59c0b98bb832fe89aba2c785d3610b1fb7fe2ed | |
| parent | feat(cargo): bump version to 0.1.0 (diff) | |
| download | windmark-78f91618b391d9db9de0a075d2d86c950d215dbd.tar.xz windmark-78f91618b391d9db9de0a075d2d86c950d215dbd.zip | |
docs(readme): fix example
| -rw-r--r-- | README.md | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 } ``` |