January 2018
Beginner
658 pages
13h 10m
English
To test, we'll save the file, move into Terminal, and shut down nodemon for the promise.js file. We'll run node for the promise.js file. It's in the playground folder, and it's called promise-2.js:
node playground/promise-2.js
Now, when we run this program, we're actually making that HTTP request. As shown in the following code output, we can see the data comes back exactly as we expected:

We get our address, latitude, and longitude variables. This is fantastic! Now let's test to see what happens when we pass in an invalid address, something like 5 zeroes, which we've used before to simulate an error:
const request ...
Read now
Unlock full access