In this post I’ll guide you through the process of setting up your Node.js application and building the script to call a server API which returns a JSON object, and ultimately iterate through its contents.

Setup the Node.js Project

Let’s dive right into it and set your Node.js project. Inside your project directory, type the node package manager initializer:

 _>npm install

Ok, now let’s get a npm package that’ll help us deal with HTTP requests later on, namely, node-fetch.

_>npm install node-fetch

Great! Now lets get to the entrails of the script next, yummy!

Write the Javascript code

Within your project’s folder create a file (ie.: ‘fetchData.js’), and…

Fabio Brigati

Full Stack Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store