I had tried to connect CouchDB
with Backbone
in HTML but could not able to connect.
Can any one please provide me some samples on how to connect CouchDB
with Backbone
in HTML
I had tried to connect CouchDB
with Backbone
in HTML but could not able to connect.
Can any one please provide me some samples on how to connect CouchDB
with Backbone
in HTML
Have you taken a look at backbone.couch? Here's some examples from their documentation:
var Backbone = require('backbone');
// Create a new backbone-couch handler for a database 'documents'.
var couch = require('backbone-couch')({
host: '127.0.0.1',
port: '5984',
name: 'documents'
});
// Create database, push default design documents to it and
// assign sync method to Backbone.
couch.install(function(err) {
Backbone.sync = couch.sync;
});
// Backbone.sync will now load and save models from a 'documents' couch db.
You 'connect' to couchDb through couchdb's REST api[1]. You would put the RESTful URLs in the Backbone model's URL and call them by overriding the sync method. This SO answer gives more detail on how this would work.[2]