0.0.0 • Published 11 years ago

chair v0.0.0

Weekly downloads
8
License
-
Repository
github
Last release
11 years ago

Chair

Relax, here is a nice comfy chair for your CouchDB.

Install

With npm do

npm install chair

About:

CouchDB module that wraps the clean api of nano and steals a feature from cradle. I found myself including both cradle and nano in a project just to use the easy design document saving of cradle. I decided in order to keep everything minimal, to implement a way to save views, allowing my views to be more reusable and removing the dependency of cradle.

Use Cases:

// Same API as nano
var chair = require('chair')('http://localhost:5984/test');

Example design doc (written as a module)

module.exports = {
    views: {
        findAll: {
            map: function (doc) {
                emit(doc);
            }
        }
    }
};

Design doc can be written as regular javascript and easily added to a database

var designDoc = require('./designDoc');

chair.design('_design/test', designDoc, function (err, body, header) {
    if(!err) {
        // Should show successful insert
        // The logic is set to auto replace on conflict
    }
});

TODO:

  • View saving functions
  • Tests
  • Docs (Check out nano docs for most of the query functions)

License

MIT

Thanks

To both @dscape and @cloudhead for both of their modules.

0.0.0

11 years ago