NODE JS REQUEST MODULE
Dec 17, 2020
Call weather API using node request module.
Install request package :- First move inside your node project folder then open terminal inside that folder and use the below command to install request package.
Package.json :- This command will add request module in you package.json file.
Code :- Below is the code call a weather API.
Here we used require function to import request module and then passing the url for API. Inside request method pass your url in object form {url:your url,json:true} or you can use JSON.parse(response.body).