diff options
| author | Fuwn <[email protected]> | 2023-03-31 22:10:02 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-31 22:10:02 +0000 |
| commit | 25cd2691af68a4f8d5acfde9bce55cc8d47bf287 (patch) | |
| tree | dc06366cd07f1795fc9f2bf93a9d52b2b9f7bfea /README.md | |
| parent | feat(carg): bump 0.2.2 -> 0.2.3 (diff) | |
| download | windmark-25cd2691af68a4f8d5acfde9bce55cc8d47bf287.tar.xz windmark-25cd2691af68a4f8d5acfde9bce55cc8d47bf287.zip | |
feat(response): macro-based responses
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -18,15 +18,15 @@ Check out an example starter project # Cargo.toml [dependencies] -windmark = "0.2.3" +windmark = "0.2.4" tokio = { version = "0.2.4", features = ["full"] } # If you would like to use the built-in logger (recommended) -# windmark = { version = "0.2.3", features = ["logger"] } +# windmark = { version = "0.2.4", features = ["logger"] } # If you would like to use the built-in MIME dedection when `Success`-ing a file # (recommended) -# windmark = { version = "0.2.3", features = ["auto-deduce-mime"] } +# windmark = { version = "0.2.4", features = ["auto-deduce-mime"] } ``` ### Implement a Windmark server @@ -41,10 +41,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { windmark::Router::new() .set_private_key_file("windmark_private.pem") .set_certificate_file("windmark_public.pem") - .mount("/", Box::new(|_| Response::success("Hello, World!"))) - .set_error_handler(Box::new(|_| { - Response::permanent_failure("This route does not exist!") - })) + .mount("/", windmark::success!("Hello, World!")) + .set_error_handler( + windmark::permanent_failure!("This route does not exist!") + ) .run() .await } |