In most cases, we will be creating controllers that will be responsible for handling requests to create, read, update, or delete a resource. These kind of CRUD operations performed on a resource make the controller resourceful. Vapor has made it easy to create such controllers by simply inheriting from their resources controller class, making it easy and straightforward to implement. Let's implement these RESTful controllers for our ShoppingList and Item Model so we can create, read, update, and delete them in the database using the API request. To get started, we need to follow these steps:
- Create a new file in the Controllers folder. Add a new empty file called ItemController.swift and make sure App target is checked. ...