Hello all- I am new to Node.js. I am facing one problem while doing a http request from an url. Every time it is showing ‘undefined’.
const request = require('request')
const url ='https://api.darksky.net/forecast/5a6c29e0d9c879cef11d4d5de29d7d78/37.8267,-122.4233'
request({ url:url }, (error,response) => {
console.log(response)
});
Node and npm version I am using –
C:\Users\lenovo>node -v
v10.16.0
C:\Users\lenovo>npm -v
6.9.1-next.0
and the dependency list attached below
Hi Randell - Sorry, this code is not there on GitHub. Do you need any more info I can assist you with?
Thanks.
Umm… does the second line above have an equals? const url 'https://...'
is likely throwing up an error.
1 Like
Hi snowmonkey - That was an typo. ignore it and proceed.
Hi, I don’t think you have any problem with your code. I just ran your code and I am getting valid response.