aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-26 10:05:15 +0000
committerFuwn <[email protected]>2022-03-26 10:05:15 +0000
commitc9472ffd8359b43c7ef21873e55bf64133b57354 (patch)
treefcd98e50d76dbbcbeaa746b6f12219f6a1add2fd
parentci(actions): rust check (diff)
downloadwindmark-c9472ffd8359b43c7ef21873e55bf64133b57354.tar.xz
windmark-c9472ffd8359b43c7ef21873e55bf64133b57354.zip
docs(readme): add implementation instructions
-rw-r--r--README.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index 92026be..bd07ac3 100644
--- a/README.md
+++ b/README.md
@@ -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.