The database is now filled with some stories. Let's implement the first route to retrieve them.
|Lists the stories of all users. An optional query parameter |
First, generate the story controller.
A new file appears in the
api subdirectory. Open it and replace its contents.
readStories method retrieves and returns the stories along with some information about their authors.
When requesting this endpoint, the response body will look like this: