Implementing business logic using hooks
The APIs for the fantasy restaurant have a specific goal: to serve our restaurant’s needs. In the Adding routes recipe, we examined the general flow but didn’t delve into details, such as the following:
- What constitutes the input for each endpoint?
- What should be the expected output of each service?
- Where should we store the data?
In this recipe, we will explore these crucial aspects in greater detail. So, let’s start with the data and its storage!
Getting ready
We require a database to store and retrieve application data. For this purpose, we will employ the well-known NoSQL database MongoDB (https://www.mongodb.com/). MongoDB is a popular NoSQL database that stores data in flexible, JSON-like documents, providing scalability and high performance for various applications. It’s important to note that the details of MongoDB are not the primary focus of this chapter, so I won’t delve...