warp+tokio example from ch1 running

This commit is contained in:
David Westgate 2024-04-10 17:05:55 -07:00
parent 19b3cc15c0
commit aa862acee0
3 changed files with 1116 additions and 2 deletions

1106
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,3 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
tokio = { version = "1.2", features = ["full"] }
warp = "0.3.7"

View File

@ -1,3 +1,9 @@
fn main() { // Example from Gruber book Ch1
println!("Hello, world!");
use warp::Filter;
#[tokio::main]
async fn main() {
let hello = warp::get().map(|| "Hello World!");
warp::serve(hello).run(([127, 0, 0, 1], 1337)).await;
} }