A q-style promise wrapper for HTTP requests
To install, go to your console/terminal and run:
npm install qreq
In your project, require the package:
var qreq = require("qreq");
To make a GET request, using the promise syntax:
qreq
.get("http://google.com")
.then(function(res){
console.log(res.body);
//...
})
.fail(function(err){
console.log(err);
//...
});
To make a GET request, using the callback syntax:
qreq.get("http://google.com", function(err, res){
if(err){
console.log(err);
//...
} else {
conslole.log(res.body);
//...
}
});
0.2.0 - Adds callback functionality