Building a CRUD API
Before we build our API, we need to define it and decide which resources we will expose and how we will expose them. For that, we are going to follow CRUD. This is a very well-known pattern that means “create, retrieve, update, and delete,” which are the operations that are implemented on each resource.
As an example, we will create an API for a shopping list. The simplicity of that API will allow us to build all we need to learn about how to make a complex API without writing a lot of code. So, let’s think a bit about what will be required.
As we said, we must decide our methods, status codes, and routes. For that, we need to know which resources we are going to expose. For simplicity, we will not implement authentication just yet, so we will not include users for now (we will do so in the next chapter). The two resources we need for now are the shopping list and the list item. From a purist perspective of REST, you would have two...