feat: add warp

This commit is contained in:
2020-08-29 10:23:30 +08:00
parent 6e7909f04d
commit 5ece072af9
4 changed files with 1324 additions and 0 deletions

13
warp/src/main.rs Normal file
View File

@@ -0,0 +1,13 @@
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], 8080))
.await;
}