January 2019
Beginner to intermediate
554 pages
13h 31m
English
In this section, we'll build a URL shortener server that exposes a /shorten endpoint. This endpoint accepts a POST request, with the body containing the URL to be shortened. Let's fire up a new project by running cargo new hyperurl with the following dependencies in Cargo.toml:
# hyperurl/Cargo.toml[dependencies]hyper = "0.12.17"serde_json = "1.0.33"futures = "0.1.25"lazy_static = "1.2.0"rust-crypto = "0.2.36"log = "0.4"pretty_env_logger = "0.3"
We'll name our URL shortening server, hyperurl. A URL shortener service is a service that provides the functionality to create a shorter URL for any given URL. When you have a really long URL, it becomes tedious to share it with someone. A lot of URL shortening ...
Read now
Unlock full access