🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async framework gemini-protocol protocol gemini rust
at main 26 lines 822 B view raw
1//! `cargo run --example input` 2 3use windmark::{context::RouteContext, response::Response}; 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("/input", |context: RouteContext| { 11 if let Some(name) = context.url.query() { 12 Response::success(format!("Your name is {}!", name)) 13 } else { 14 Response::input("What is your name?") 15 } 16 }) 17 .mount("/sensitive", |context: RouteContext| { 18 if let Some(password) = context.url.query() { 19 Response::success(format!("Your password is {}!", password)) 20 } else { 21 Response::sensitive_input("What is your password?") 22 } 23 }) 24 .run() 25 .await 26}