aboutsummaryrefslogtreecommitdiff
path: root/examples/mime.rs
blob: b61c84417ad0ffa333f1178c3d180a803f928e44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! `cargo run --example mime`

#[windmark::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  windmark::router::Router::new()
    .set_private_key_file("windmark_private.pem")
    .set_certificate_file("windmark_public.pem")
    .mount("/mime", |_| {
      windmark::response::Response::success("Hello!".to_string())
        .with_mime("text/plain")
        .clone()
    })
    .run()
    .await
}