warp+tokio example from ch1 running
This commit is contained in:
parent
19b3cc15c0
commit
aa862acee0
1106
Cargo.lock
generated
1106
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -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"
|
||||||
|
10
src/main.rs
10
src/main.rs
@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user