Using the OpenWeatherMap
API to build a simple Application which displays Temperature, Country Name and Location of the City.
In this Code i have used the OpenWeatherMap.org API and display the result to the console. Create an account and generate the API Key.
Create a directory named NodeJs-WeatherApp
and run the command
npm init
This will create a package.json
file.
To call the API i have used the npm module called request. This is used to make HTTP requests. Run the following command to install it.
npm install request --save
Here is a screen-shot of the output.
You can also call this script from an HTML page, in your website. 😊