Now let's test our new API:
- If we go to http://localhost:3000/api, we are going to display a list of the endpoints. This is optional, but it is useful as a reference for developers:
- If you go to http://localhost:3000/api/posts, you will see all the posts:
- Also, if you hit http://localhost:3000/api/post/1, you will get the first post of the list:
- Finally, if you try to get a post that does not exist in our data (http://localhost:3000/api/post/99 ...