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 | ce7c92422516413cf6f5c9b03e3903648916752b (patch) | |
| tree | b59c0b98bb832fe89aba2c785d3610b1fb7fe2ed | |
| parent | feat(cargo): bump version to 0.1.0 (diff) | |
| download | windmark-ce7c92422516413cf6f5c9b03e3903648916752b.tar.xz windmark-ce7c92422516413cf6f5c9b03e3903648916752b.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 } ``` |