Use Cloudant with promises. Cloudant-promise binds together nano-promises
and cloudant
.
$ npm install cloudant-promise --save
const cloudant = require('cloudant-promise');
const credentials = {
account : '<account>',
password : '<password>'
};
const db = cloudant(credentials).db.use('alice');
db.insert({ 'crazy': true }, 'rabbit')
.then(body => console.log(body))
.catch(err => console.error(err));
This library is licensed under Apache 2.0. Full license text is available in COPYING.