Testing the Express application
In this section, we'll be setting up an Express app and then, we'll look at how we can test it to verify that the data that comes back from our routes is what the user should be getting. Now before we do any of that, we will need to create an Express server and that's the goal of this section.
Setting up testing for the Express app
We'll start with installing Express. We'll use npm i
, which is short for install, to install Express. Remember, you could always replace install with i
. We'll grab the most recent version, @4.16.2
. Now, we'll be using the save
flag as opposed to the save dev
flag that we've used for testing in the previous chapter:
npm i [email protected] --save
This command is going to install Express as a regular dependency, which is exactly what we want:

We need Express when we deploy to production, whether it's Heroku or some other service.
Back inside the app, if we open up package.json
, we can see we have dependencies which we've seen before, and devDependencies...