diff options
| author | Fuwn <[email protected]> | 2022-03-26 10:05:15 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-26 10:05:15 +0000 |
| commit | c9472ffd8359b43c7ef21873e55bf64133b57354 (patch) | |
| tree | fcd98e50d76dbbcbeaa746b6f12219f6a1add2fd | |
| parent | ci(actions): rust check (diff) | |
| download | windmark-c9472ffd8359b43c7ef21873e55bf64133b57354.tar.xz windmark-c9472ffd8359b43c7ef21873e55bf64133b57354.zip | |
docs(readme): add implementation instructions
| -rw-r--r-- | README.md | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -8,6 +8,8 @@ Windmark is a simple and highly performant Gemini server framework. ## Usage +### Add Windmark as a dependency + ```toml # Cargo.toml @@ -18,6 +20,21 @@ windmark = "0.1.0" # windmark = { version = "0.1.0", features = ["logger"] } ``` +### Implement a Windmark server + +```rust +use windmark::response::Response; + +fn main() -> std::io::Result<()> { + windmark::Router::new() + .mount("/", |_, _, _| Response::Success("Hello, World!".into())) + .set_error_handler(|_, _, _| { + Response::PermanentFailure("This route does not exist!".into()) + }) + .run() +} +``` + ## Examples Examples can be found within the [`examples/`](./examples) directory. |