Forked from trisapeace/extended-pouchdb-backbone.js
Created
September 26, 2012 19:52
-
-
Save cesine/3790182 to your computer and use it in GitHub Desktop.
Backbone and PouchDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Corpus = Backbone.Model.extend({ | |
changePouch : function(couchConnection, callback) { | |
this.pouch = Backbone.sync.pouch(couchConnection.pouchname); | |
callback(); | |
}, | |
saveAndInterConnectInApp : function(callback) { | |
callback(); | |
} | |
}); | |
var myCorpus = new Corpus({id: 2}); | |
// GET the book from PouchDB's corpusdb database | |
// POST or PUT the book to PouchDB's corpusdb2 database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Corpus = Backbone.Model.extend({ | |
urlRoot: '/corpus' | |
}); | |
var myCorpus = new Corpus({id: 2}); | |
// GET the corpus from /corpus/2 | |
myCorpus.fetch(); | |
// POST or PUT the corpus to /corpus/2 | |
myCorpus.save(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Corpus = Backbone.Model.extend({ | |
pouch: Backbone.sync.pouch('idb://corpusdb'), | |
}); | |
var myCorpus = new Corpus({id: 2}); | |
// GET the corpus from PouchDB's corpusdb database | |
myCorpus.fetch(); | |
// POST or PUT the corpus to PouchDB's corpusdb database | |
myCorpus.save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment