unanimity

Making backbone.js and nano seamlessly work together!

unanimity

A nano sync for Backbone.js.

npm install unanimity

var nano = require('nano')('http://localhost:5984/')
  , backbone = require('backbone')
  , unanimity = require('unanimity')
  ;
 
var db = nano.use('test');
 
// bind the database to backbone 
unanimity(backbone, db)
 
// Model id is the document id 
var user = new backbone.Model(id: 'user:john.doe')
 
// Fetch data 
user.fetch({
  successfunction(){
    console.log(user.toJSON());
  }
});

Syntax is fully compatible with original Backbone.js save/fetch.