Now that the login is configured, you can add two new routes to create and delete stories. Their access will be limited to authenticated users.
|Creates a new story.|
|Deletes a story.|
stories.controller.ts file and add two new methods to the controller.
When sending a request to these endpoints, the
@UserRequired hook will return a 401 error if
ctx.user is not defined (i.e. if the user has not logged in first). But if it is, the controller method will be executed.
Go to http://localhost:3001/swagger and check that the controller is working as expected. You can, for example, first try to create a story without being connected and then log in and try again.