🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async
framework
gemini-protocol
protocol
gemini
rust
1//! `cargo run --example responses --features response-macros`
2
3use windmark::success;
4
5#[windmark::main]
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 windmark::router::Router::new()
8 .set_private_key_file("windmark_private.pem")
9 .set_certificate_file("windmark_public.pem")
10 .mount(
11 "/",
12 success!(
13 "# Index\n\nWelcome!\n\n=> /test Test Page\n=> /time Unix Epoch"
14 ),
15 )
16 .mount("/test", success!("This is a test page.\n=> / back"))
17 .mount(
18 "/failure",
19 windmark::temporary_failure!("Woops ... temporarily."),
20 )
21 .mount(
22 "/time",
23 success!(std::time::UNIX_EPOCH.elapsed().unwrap().as_nanos()),
24 )
25 .mount(
26 "/redirect",
27 windmark::permanent_redirect!("gemini://localhost/test"),
28 )
29 .run()
30 .await
31}