So,I've set up this route which gets JSON data from an internal API and displays it.The first time I visit the route I get the correct JSON data but when I refresh the page I get an error and the page just stucks loading.Any ideas?
Note: I use request-promise
app.get('/',function(req,res){
var options = {
//Here I initiate the API call.I actually have a url here.
uri: '',
json: true
};
request(options)
.then(function(data) {
res.json(data);
res.end();
})
.catch(function (err) {
console.log(err);
});
});
via sterg
No comments:
Post a Comment