When I tried to get the response from the requested URL, I can get only printed statements of 'out' its not going in the requestify and how to get the response from requestify. Can any one tell me what is the error behind this.
console.log('out');
requestify.get('http://www.google.com').then(function(response) {
// Get the response body
console.log('in');
response.getBody();
console.log(response.body);
});
console.log('out');
Did you add
var requestify = require('requestify');
above your code?
Also, due to the async behavior of NodeJS it will probably first display 'out' twice and after you recieved a response from Google it will display the google homepage HTML.
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