X-Git-Url: https://piware.de/gitweb/?p=learn-rust.git;a=blobdiff_plain;f=warp-server%2Fsrc%2Fmain.rs;fp=warp-server%2Fsrc%2Fmain.rs;h=70b3cc3f516dbf3bfb622a7f2231435682b0d609;hp=0000000000000000000000000000000000000000;hb=660eb0d2c9664a89a379f0d65923a4c8721a20b8;hpb=0c3d5c7fa2ab4c6a9eba6fc4e5ce0a70a8a6c08c diff --git a/warp-server/src/main.rs b/warp-server/src/main.rs new file mode 100644 index 0000000..70b3cc3 --- /dev/null +++ b/warp-server/src/main.rs @@ -0,0 +1,12 @@ +use warp::Filter; + +#[tokio::main] +async fn main() { + // GET /hello/warp => 200 OK with body "Hello, warp!" + let hello = warp::path!("hello" / String) + .map(|name| format!("Hello, {}!", name)); + + warp::serve(hello) + .run(([127, 0, 0, 1], 3030)) + .await; +}