4 Performing database operations
This chapter covers
- Writing our first async connection to a database
- Setting up the web service and writing unit tests
- Creating and querying records in the database
In the previous chapter, we built a web service that uses an in-memory data store. In this chapter, we’ll enhance that web service, replacing the in-memory data store with a relational database.
Our enhanced web service will expose the same set of APIs as before, but we will now have a proper database to persist the data to disk—we do not want our data to get lost every time we restart the web service. As there are many parts involved, we will develop this database-backed web service iteratively over three iterations of code:
-
In the first iteration, ...
Get Rust Servers, Services, and Apps 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.