From c9472ffd8359b43c7ef21873e55bf64133b57354 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 26 Mar 2022 10:05:15 +0000 Subject: docs(readme): add implementation instructions --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. -- cgit v1.2.3