Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/colinf/couchbone-todos
An example application to demonstrate how to use the ss-couchbone Socketstream Request Responder
https://github.com/colinf/couchbone-todos
Last synced: 9 days ago
JSON representation
An example application to demonstrate how to use the ss-couchbone Socketstream Request Responder
- Host: GitHub
- URL: https://github.com/colinf/couchbone-todos
- Owner: colinf
- License: mit
- Created: 2012-06-27T14:23:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-06T20:08:38.000Z (about 12 years ago)
- Last Synced: 2024-04-14T14:12:13.643Z (7 months ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Backbone.js Todos example app using ss-couchbone
This is an example application to demonstrate how to use the [ss-couchbone](https://github.com/colinf/ss-couchbone) Socketstream Request Responder.
It's based on the [original backbone.js example](http://backbonejs.org/examples/todos/index.html) Todos application but has been modified so that, instead of using browser localstorage to save the todo list, it uses a CouchDB database at the server end over websockets. The ss-couchbone request responder is used to enable this.
## Running the example
### Create the database
You need to create a CouchDB database to store the todo list. Assuming that you already have a CouchDB instance that you can access, this is done as follows:1. Create an empty database called **cb-todos** (you can call it something else if you prefer and then amend the relevant setup step below accordingly).
2. Create a view on your new database with details as below. If you're not that familiar with CouchDB views, you can do this using CouchDB Futon and there is a simple writeup on this [blog page](http://blog.vicmetcalfe.com/2011/04/11/creating-views-in-couchdb-futon/). The details for the design document you should create for the view are as follows:
* _id: "_design/views"
* views: see following code snippet```javascript
{
"testview": {
"map": "function(doc) {emit(doc._id, doc)}"
}
}
```
### Database connection setup
You now need to enter the connection details for the CouchDB database that you have created. The good news is that if you are running CouchDB on localhost using the default port of 5984 and have used the suggested database name of **cb-todos** as per step 1 above, then you can skip this step of database connection setup and move straight on to running the app below.If you do need to customise the database connection details then edit the file client/code/app/app.js and search for "setup". You should see the code below:
```javascript
ss.cbone('setup', {
host: 'http://localhost',
port: 5984,
cache: true,
raw: false}, 'cb-todos');
```
Edit the values for your database host/port accordingly and change the name of the database from cb-todos if you have chosen your own.
### Run the app
Finally, to start your app use the following standard command from the couchbone-todos directory:node app.js
And then visit the app at:http://localhost:3000
where you should be able to use the Todos example application in exactly the same way as the original.### License ###
The MIT License - see the file LICENSE.txt within the repository for details.