Skip to content

Kanso package - uses CouchDB for storage and doesn't push extra design docs like backbone-couch

Notifications You must be signed in to change notification settings

kanso/backbone-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

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

About

Kanso package - uses CouchDB for storage and doesn't push extra design docs like backbone-couch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published