In the previous chapter, we added the ability to log metrics about our applications. Next to the extraction of code into several modules, this makes for an already solid web service. We try to go through the steps as you would do at the start of writing a new web service.
Chapters 1 to 6 provided a solid foundation, which we will build out in the remaining chapters. We will move more and more toward a production-grade application, and one step almost all web services have to face at some point is talking to a database.
Handling the nitty-gritty database internals is not the focus of this book, so what we are going to do is set up an example database so we can store and retrieve data from it. The important part is understanding how to connect to a database with Rust, where you should abstract the interaction with the database, and how it affects your code.