moul / node-scaleway

:wrench: Online Labs API client in Node.js and browser javascript
https://www.npmjs.com/package/scaleway
MIT License
19 stars 5 forks source link

Expose bluebird promises… #4

Closed tusbar closed 9 years ago

tusbar commented 9 years ago

… instead of httpinvoke’s homemade wrapper.

Feel free to merge, or not. But https://github.com/request/request response objects are more common, so are Bluebird promises.

I removed the hook as I’m not sure that it does anything.

moul commented 9 years ago

Let's go :)

moul commented 9 years ago

released at v0.3.0 on npm

moul commented 9 years ago

Promises are better, but we lose the normal callbacks Is there a solution to keep promises and callbacks working together as did httpinvoke ? (cc @tusbar)

tusbar commented 9 years ago

No no, nodejs callbacks still work fine as I’m using .nodeify().

var sdk = new (require('.'))();

sdk.get('/', function (err, res) {
    console.log(res.body);
});

See https://github.com/petkaantonov/bluebird/blob/master/API.md#nodeifyfunction-callback--object-options---promise