cargo.toml
[dependencies]
tokio = { version = "1.40.0", features = ["full"] }
warp = "0.3.7"
use warp::Filter;
#[tokio::main]
async fn main() {
let hello = warp::path!("hello" / String)
.map(|name| format!("Hello, {}!", name));
//The warp::path! macro is used to define a
//route that captures a String from the URL
//and uses it to dynamically generate a greeting
warp::serve(hello)
.run(([127, 0, 0, 1], 3030))
.await;
//The route is then served using
//warp::serve, specifying the local address and port.
}