JavaScript Icon

cradle - A high-level, caching, CouchDB client for Node.js

logged by @logbot 2010-02-16T20:36:00Z permalink #javascript #node

Intended to be a higher-level API on top of Couch, cradle from Alexis Sellier tries to bridge what’s best about CouchDB and Node.js. Cradle comes with built-in write-through caching to boost speed and easier updates and deletes.

Most methods from CouchDB map one-to-one with Cradle although some like save can orchestrate multiple operations.

From the README

var cradle = require('cradle');
var db = new(cradle.Connection).database('starwars');

db.get('vador').addCallback(function (doc) {; // 'Darth Vador'
    assert.equal(doc.force, 'dark');
});'skywalker', {
    force: 'light',
    name: 'Luke Skywalker'
}).addCallback(function (res) {
    // Handle success
}).addErrback(function (res) {
    // Handle error

[Source on GitHub] [Follow Alexis Sellier on Twitter]

0:00 / 0:00