Building a bookmarks API using Actix-web

We'll create a REST API server that allows you to store bookmarks and links to any blog or website that you wish to read later. We'll name our server linksnap. Let's create a new project by running cargo new linksnap. In this implementation, we won't be using a database for persistence for any link that is sent to our API, and will simply use an in-memory HashMap to store our entries. This means that every time our server restarts, all of the stored bookmarks will get removed. In Chapter 14, Interacting with Databases in Rust, we'll integrate a database with linksnap, which will allow us to persist bookmarks.

Under the linksnap/ directory, we have the following contents in Cargo.toml:

# linksnap/Cargo.toml ...

Get Mastering Rust - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.