Sunday, 23 April 2017

Node GET request not working

I'm writing an Alexa Skill that makes an API call to Google Calendar, but my GET request is not working.

var request = require('request');
console.log("Before requests");

// getUrl is the the url and returns the data when entered into my browser            
request(getUrl, function (error, response, body) {
    console.log('error:', error);  
    console.log('statusCode:', response && response.statusCode);  
    console.log('body:', body);  
});

I'm using request to make the http call and this code is literally just copied from the github page, but nothing is logged to the console, so I'm not sure how to debug what's going wrong. Using other methods like http.get(options, callback) have yielded the same results - any console.log() in the callback does not get executed. Does anyone have any insight? Thanks!



via mcheah

No comments:

Post a Comment