Im trying to get a working http.get client function working in Meteor. However I keep getting my own page as result.
Here is my code:
Meteor.http.get("api.openweathermap.org/data/2.5/weather?q=London,uk", function (error, result) {
if(error) {
console.log('http get FAILED!');
} else {
console.log('http get SUCCES');
if (result.statusCode === 200) {
console.log('Status code = 200!');
console.log(result.content);
}
}
});
I would expect that it returned a json object containing weather information. Do I miss something here?
Thanks.
Please update the url by adding http://
at beginning.
Moreover make this call from your server, i.e. Make a method that contains the above code and call that method via Meteor.call()
;
Please see Meteor.methods() and Meteor.call()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With