Is it possible to make a request in the controller? I have tried using the node.js http module but didn't have any succes. Is there any other method to do this?
Ok, I managed to solve this using another module 'request'. What I did:
Install the module in your project:
npm install -S request
And in you code you should have:
var request = require('request');
request.get({
url: <your url>
}, function(error, response, body) {
if (error) {
sails.log.error(error);
}
else {
sails.log.info(response);
sails.log.info(body);
}
});