Skip to content
/ co-nano Public

Exposes couchdb nano library API as thunks for use with co and koa.

License

Notifications You must be signed in to change notification settings

OlavHN/co-nano

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

co-nano

Exposes couchdb nano library API as thunks for use with co and koa.

Install with npm install co-nano

nano methods return (err, body, header), meaning the co-nano wrappers will throw err, and yield [body, header].

Usage: (Destructuring syntax not yet in V8 / node)

var co = require('co');
var nano = require('nano')('http://localhost:5984');
var coNano = require('co-nano')(nano);

co(function *() { // Or inside a koa handler
  yield coNano.db.create('myDb');

  var db = coNano.use('myDb'); 
  // with destructuring: 
  var [body, headers] = yield db.insert({hello: 'world'}, 'myDocument');
  
  // without destructuring:
  var res = yield db.insert({hello: 'world'}, 'myDocument');
  var body = res[0], headers = res[1];
})();

About

Exposes couchdb nano library API as thunks for use with co and koa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published