Node.js Open Weather Map API for Weather Forecasts Last Updated : 08 Oct, 2021 Comments Improve Suggest changes Like Article Like Report The Open Weather Map API is very popular as it allows you to request weather forecasts and historical weather data programmatically.Feature of Open Weather Map API: It is easy to get started and easy to use.It is widely used and popular API for Weather Forecasts. Installation of request module: You can visit the link to Install Request module. You can install this package by using this command. npm install requestAfter installing request module you can check your request version in command prompt using the command. npm version requestNow go to Open Weather Map website and create an account and get your API KEY.After that, you can create a folder and add a file, for example index.js. To run this file you need to run the following command. node index.js Filename: index.js index.js const request = require('request'); var API_KEY = 'your_api_key'; const forecast = function (latitude, longitude) { var url = `http://api.openweathermap.org/data/2.5/weather?` +`lat=${latitude}&lon=${longitude}&appid=${API_KEY}` request({ url: url, json: true }, function (error, response) { if (error) { console.log('Unable to connect to Forecast API'); } else { console.log('It is currently ' + response.body.main.temp + ' degrees out.' ); console.log('The high today is ' + response.body.main.temp_max + ' with a low of ' + response.body.main.temp_min ); console.log('Humidity today is ' + response.body.main.humidity ); } }) } var latitude = 22.7196; // Indore latitude var longitude = 75.8577; // Indore longitude // Function call forecast(latitude, longitude); Steps to run the program: The project structure will look like this: Make sure you have installed request module using following command: npm install requestRun index.js file using below command: node index.js So this is how you can use the Open Weather Map API which allows you to request weather forecasts and historical weather data programmatically. Comment More infoAdvertise with us Next Article Node.js Open Weather Map API for Weather Forecasts G gouravhammad Follow Improve Article Tags : JavaScript Web Technologies Node.js Node.js-Misc Similar Reads Create a Real-Time Weather Forecast App with React Real-time weather forecast app with React involves integrating with a weather API to fetch weather data and display it in the UI. Individuals can use the app to check the current weather conditions, temperature, humidity, and other relevant weather data for their location or any city they are intere 5 min read Create a Weather App with Forecast using React-Native React-Native is an open-source framework used to develop cross-platform applications i.e., you can write code in React-Native and publish it as an Android or IOS app. In this article, we will build a weather app using React-Native. The app contains two features:Getting the current weather of a given 5 min read Weather Forecast App using MERN Stack This project is a simple weather application built using React.js for the frontend and Node.js with Express.js for the backend. It allows users to check the current weather and forecast for a specific city. The backend retrieves weather data from the OpenWeatherMap API and stores it in a MongoDB dat 7 min read Create a Weather Monitoring Dashboard with Next.js This project involves building a Weather Monitoring Dashboard using NextJS. The dashboard allows users to check the current weather and forecast for a specific city, as well as an hourly forecast for the next few hours and a daily forecast for the next four days. Output Preview: Let us have a look a 6 min read Create a Weather Forecast Template using Tailwind CSS The Weather Forecast Project enables the user to use real-time weather information for the city for which they have searched. We have used API which provides us with access to weather data from around the world. We have fetched the weather information for various locations, including wind speed, Hum 3 min read Like