Hyper is arguably the most stable and well-known of Rust-based HTTP frameworks. It has two distinct components, one for writing HTTP servers and one for writing clients. Recently, the server component was moved to a new async programming model based on tokio and futures. As a result, it is well-suited for high-traffic workloads. However, like a lot of other libraries in the ecosystem, Hyper has not hit Version 1.0 yet, so one should expect breaking API changes.
We will start with writing a small HTTP server in Hyper. Like always, we will need to set up our project using Cargo.
$ cargo new --bin hyper-server
Let us now add dependencies that will include hyper and futures. The Cargo.toml file will look as follows:
[package]
name = "hyper-server"
version = "0.1.0"
authors = ["Foo<foo@bar.com>"]
[dependencies]
hyper = "0.11.7"...