cloudant.db.destroy('rte', function() { // Create a new database. cloudant.db.create('rte', function() { // specify the database we are going to use var rte = cloudant.use('rte') // and insert a document in it rte.insert({ crazy: true }, 'IBM PaaS', function(err, body, header) { if (err) return console.log('[rte.insert] ', err.message) console.log('you have inserted the document') res.write('you have inserted the document') res.write(body) console.log(body) }) }) })
cloudant({account:cloudantenv.username, password:cloudantenv.password}, function(er, cloudant) { if (er) return console.log('Error connecting to Cloudant account %s: %s', me, er.message) // Clean up the database we created previously. cloudant.db.destroy('rte', function() { // Create a new database. cloudant.db.create('rte', function() { // specify the database we are going to use var rte = cloudant.use('rte') // and insert a document in it rte.insert({ crazy: true }, 'IBM PaaS', function(err, body, header) { if (err) return console.log('[rte.insert] ', err.message) console.log('you have inserted the document') res.write('you have inserted the document') res.write(body) console.log(body) }) }) }) })