aboutsummaryrefslogtreecommitdiff
path: root/examples/warp.rs
blob: c705b47dabed6e6d73b2c4ed8b606ee24b11a1f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use warp::Filter;

#[tokio::main]
async fn main() {
    let hello = warp::path!("hello" / String)
        .map(|name| format!("Hello, {}!", name));
    let health = warp::path!(".within" / "health")
        .map(|| "OK");
    let routes = hello.or(health);

    warp::serve(routes)
        .run(([0, 0, 0, 0], 3030))
        .await;
}