- Create a Rust project to work on during this chapter with cargo new chapter-nine
- Navigate into the newly created chapter-nine folder. For the rest of this chapter, we will assume that your command line is currently in this directory
- Open the Cargo.toml file that has been generated for you
-
Under [dependencies], add the following lines:
futures = "0.1.18"
hyper = "0.11.21"
- If you want, you can go to futures' (https://crates.io/crates/futures) and hyper's (https://crates.io/crates/hyper) crates.io pages to check for the newest version and use that one instead
- Inside the folder src, create a new folder called bin
- Delete the generated lib.rs file, as we are not creating a library
- In the folder src/bin, create a file called hello_world_server.rs
- Add the following code and run it with cargo run --bin hello_world_server:
1 extern crate futures; 2 extern crate hyper; 3 4 use futures::future::Future; 5 use hyper::header::{ContentLength...