Open basham opened 9 years ago
Extend request object, so you can change this code:
request
var request = require('superagent'); request .post(api) .end(function(res, err) { if(err || !res.ok) { // error return; } // success });
To this:
var request = require('superagent'); var requestPromise = require('superagent-promise'); request .use(requestPromise) .post(api) .then(function(value) { // success }) .catch(function(err) { // error }) .done();
https://github.com/visionmedia/superagent#plugins https://github.com/johntron/superagent-no-cache/blob/master/index.js https://github.com/johntron/superagent-prefix/blob/master/index.js https://github.com/wheresrhys/superagent-promises/blob/master/index.js
Extend
request
object, so you can change this code:To this: