An open API service indexing awesome lists of open source software.

https://github.com/chrisekelley/couchabb

couchapp plus backbone-boilerplate and Syncpoint-created db support
https://github.com/chrisekelley/couchabb

Last synced: 3 months ago
JSON representation

couchapp plus backbone-boilerplate and Syncpoint-created db support

Awesome Lists containing this project

README

        

## Couchabb

Couchabb is a demonstration [Couchapp](http://couchapp.org) used in [Andromeda](https://github.com/chrisekelley/Andromeda), which demonstrates how to manage the user registration and management process using [TouchDB-Android](https://github.com/couchbaselabs/TouchDB-Android) and [Syncpoint-Android](https://github.com/couchbaselabs/Syncpoint-Android).

Couchabb is a demonstration of the [TodoMVC backbone-require](https://github.com/addyosmani/todomvc/tree/master/dependency-examples/backbone_require)
app, which has been modified to work as a [Backbone boilerplate](https://github.com/tbranyen/backbone-boilerplate) project. The [TodoMVC](https://github.com/addyosmani/todomvc) project serves as a demonstration of popular javascript MV* frameworks.
I am using TodoMVC as a generic project called [couchabb](https://github.com/chrisekelley/couchabb) to help assess TouchDB-Android performance. Couchabb also uses [backbone boilerplate](https://github.com/tbranyen/backbone-boilerplate).

## Supports two Couch databases.

Couchabb is designed to work initially with the original bootstrap db - the db that was initially installed. (It may have been named couchabb.) When the user registers an e-mail address, the Syncpoint library creates a new local db that has a unique name. In main.js, the app checks if the Syncpoint control database has been create and queries it (/sp_control/_design/control/_view/by_type?key=%22installation%22) for the new local db name. That name becomes the Backbone.couch_connector.config.db_name and is used by the app instead of the original db.

## Generated by CouchApp

CouchApps are web applications which can be served directly from [CouchDB](http://couchdb.apache.org). This gives them the nice property of replicating just like any other data stored in CouchDB. They are also simple to write as they can use the built-in jQuery libraries and plugins that ship with CouchDB.

[More info about CouchApps here.](http://couchapp.org)

## Deploying this app

Assuming you just cloned this app from git, and you have changed into the app directory in your terminal, you want to push it to your CouchDB with the CouchApp command line tool, like this:

couchapp push . http://name:password@hostname:5984/mydatabase

If you don't have a password on your CouchDB (admin party) you can do it like this (but it's a bad, idea, set a password):

couchapp push . http://hostname:5984/mydatabase

If you get sick of typing the URL, you should setup a `.couchapprc` file in the root of your directory. Remember not to check this into version control as it will have passwords in it.

The `.couchapprc` file should have contents like this:

{
"env" : {
"public" : {
"db" : "http://name:[email protected]/mydatabase"
},
"default" : {
"db" : "http://name:pass@localhost:5984/mydatabase"
}
}
}

Now that you have the `.couchapprc` file set up, you can push your app to the CouchDB as simply as:

couchapp push

This pushes to the `default` as specified. To push to the `public` you'd run:

couchapp push public

Of course you can continue to add more deployment targets as you see fit, and give them whatever names you like.

Other useful info
-----------------

It's a pain to run 'couchapp push' everytime you make a change. Mike wrote a little [watchr](http://rubygems.org/gems/watchr) script that watches for changes to any relevant files and then automatically pushes them into your couch. To get it you need to install rubygems and watchr:

apt-get install rubygems
gem install watchr

To run it, just

watchr file.watchr