18 lines
445 B
Rust
18 lines
445 B
Rust
|
use warp::Filter;
|
||
|
|
||
|
#[tokio::main]
|
||
|
async fn main() {
|
||
|
// Match any request and return hello world!
|
||
|
let routes =
|
||
|
warp::path::end()
|
||
|
.map(|| "Hello, World!")
|
||
|
.or(
|
||
|
warp::path!(String)
|
||
|
.and(
|
||
|
warp::get()
|
||
|
)
|
||
|
.map(|x| format!("u get {x}"))
|
||
|
);
|
||
|
|
||
|
warp::serve(routes).run(([127, 0, 0, 1], 3030)).await;
|
||
|
}
|