]> piware.de Git - learn-rust.git/blob - warp-server/src/main.rs
warp-server: Initial hello world
[learn-rust.git] / warp-server / src / main.rs
1 use warp::Filter;
2
3 #[tokio::main]
4 async fn main() {
5     // GET /hello/warp => 200 OK with body "Hello, warp!"
6     let hello = warp::path!("hello" / String)
7         .map(|name| format!("Hello, {}!", name));
8
9     warp::serve(hello)
10         .run(([127, 0, 0, 1], 3030))
11         .await;
12 }