Relax, here is a nice comfy chair for your CouchDB.
With npm do
npm install chair
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.
// 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
}
});
- View saving functions
- Tests
- Docs (Check out nano docs for most of the query functions)
MIT
To both @dscape and @cloudhead for both of their modules.