Skip to content

Instantly share code, notes, and snippets.

@mamund
Created January 18, 2012 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamund/1635675 to your computer and use it in GitHub Desktop.
Save mamund/1635675 to your computer and use it in GitHub Desktop.
Cradle w/ credentials option
// for couch
var cradle = require('cradle');
var host = 'https://xxxx.cloudant.com';
var port = 443;
var credentials = {username: 'xxxx', password: 'xxxx' };
var local=false;
var db;
if(local===true) {
db = new(cradle.Connection)().database('xxxx');
}
else {
db = new(cradle.Connection)(host, port, {auth: credentials}).database('xxx');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment