Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Kanso package - uses CouchDB for storage and doesn't push extra design docs like backbone-couch
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
backbone-adapter.js
kanso.json

README.md

Backbone Adapter

Uses CouchDB for storage, does not push extra design docs like backbone-couch, leaving you in control of the views. Also uses the db module instead of writing it's own client on top of jQuery.

Usage

In your app initialization, set the db URL for your app and replace the default Backbone sync function with the one provided by the adapter.

var Backbone = require('backbone'),
    adapter = require('backbone-adapter');

Backbone.db = '/my/db/url';
Backbone.sync = adapter.sync;

Then, in your Collections, define the CouchDB view they relate to:

exports.TestList = Backbone.Collection.extend({
    ...
    view: {
        ddoc: 'appname',
        name: 'types',
        query: {
            key: ['test']
        }
    }
});

This will fetch the view at /my/db/url/\_design/appname/\_view/types?key=%5B%22test%22%5D&include_docs=true

Something went wrong with that request. Please try again.