Testing the GET /todos route 

I'm going to fire up the server using the following command:

node server/server.js

Inside of Postman, we can get started by creating some Todos. Currently, our application and the tests for the application use the same database. The beforeEach method call we ran in the last section unfortunately wiped everything, which means we have no data to fetch. The first thing I'm going to do in Postman is try to fetch the data we should get back an empty array, which should still work. The URL is going to be localhost:3000/todos and it is indeed going to be a GET request. I can click Send, which is going to fire off the request, and we get our data back:

We have an object, we have our todos property, and we have our empty array, which is expected.

Now, as you may have noticed, manually configuring a route every single time you want to use it gets pretty tedious, and we're going to be using a lot of the same routes over and over again. With Postman, we can actually create a collection of routes so we can re-fire requests without having to manually enter all of the information. Over on the right-hand side, I can click the drop-down arrow next to Save and click Save As. Here, I can give my request a little bit of detail:

I'm going to change the Request Name to GET /todos; this is the naming convention I like to use, the HTTP method followed by the URL. We can leave the description blank for now, and we can create a new collection since we don't have any. The Postman Echo collection is an example collection Postman gives you to explore this feature. We're going to make one called Todo App. Now, anytime we want to run that command, all we do is we go to Collections, click GET /todos, click Send, and the request fires.

Let's go ahead and set up a POST request to create a Todo, and then we'll run that, save it, and rerun GET to make sure it returns the newly created Todo.