Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeybaker/flatiron-couch-backbone
A flatiron plugin that allows you to use Backbone server side, and uses Couch for it's data store.
https://github.com/joeybaker/flatiron-couch-backbone
Last synced: 6 days ago
JSON representation
A flatiron plugin that allows you to use Backbone server side, and uses Couch for it's data store.
- Host: GitHub
- URL: https://github.com/joeybaker/flatiron-couch-backbone
- Owner: joeybaker
- Created: 2013-03-29T18:55:17.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-05T19:01:10.000Z (almost 12 years ago)
- Last Synced: 2024-11-27T11:13:03.331Z (about 2 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
flatiron-couch-backbone
=======================# DEPRECATED
This plugin is now *wheelhouse-couch*https://npmjs.org/package/wheelhouse-couch
https://github.com/joeybaker/wheelhouse-couchA flatiron plugin that allows you to use Backbone server side, and uses Couch for it's data store. This is largely a rewrite of [backbone-couch](https://github.com/developmentseed/backbone-couch) to get it to play nicely with [flatiron](https://github.com/flatiron/flatiron) and use the excellent [cradle](https://github.com/cloudhead/cradle) CouchDB library.
## Usage
```js
var flatiron = require('flatiron')
, app = flatiron.app
, dbPlugin = require('flatiron-couch-backbone')app.use(flatiron.plugins.http, {})
app.use(dbPlugin, {
name: 'database-name'
, host: 'localhost' // default
, port: 5984 // default
// also takes cradle options
, cache: true // disabled by default in development
, raw: false // cradle default
, callback: function(){} // do something after the database connection has been established
, getId: function(model){ // used to get the DB id from the model. the default behavior follows: {{collectionName}}/{{UUID}}
return model.url().substring(1) // default
}
, getCollectionName: function(collection){
return collection.url.substring(1) // default
}
})
app.start(8999)
```After using the plugin, `Backbone.sync` is overridden to use CouchDB.
### Important note:
Your models should override the default `id` attribute to use `_id`.```js
var model = Backbone.Model.extend({
idAttribute: '_id'
})
```## tests
You must have [grunt-cli](https://github.com/gruntjs/grunt-cli) installed: `sudo npm i -g grunt-cli`### Run tests
`npm test`