A core rest api for a couchdb database
This module provides a generic restful api for accessing couchdb documents. By dropping this module in your express application you can immediately start managing couchdb documents via a restful crud interface in your single page application. This module only includes list, create, read, update and delete, it does not include any view or query functionality, this has to be implemented in your express application.
npm install express-couchdb-core --save// add model design and all view to couchDbnode init.js [couchdb]
var core = ;var config = couch: '' ;app;
If you would like to dynamically change which database is being used, then use
the following configuration and set the request parameter given to the name of
the database to use. The
database_parameter_name is optional and will default
var config = url: '' database_parameter_name: 'COUCH_DB'
The api uses the term model to represent the document type, and it is assumed that when you store your documents you will use the type node in the document to represent the model type. For example,
will return all documents of type "person"
Returns a list of documents of the type
Create a document of type
Returns a couch document
Updates an existing couch document or creates a couch document with specific id
Deletes a couch document
This module comes with a feature to add child docs that can also be pulled down with a get request from the parent as an array in the parent node.
Next we post a child document to foo and we use the underscore to indicate it is a child document type and use the [model]_id to assign ownership to the parent document.
This will link the document type foo_bar as a child to document type foo. And when you get the foo document of id 1, it will return the foo document with a key called foo_bar:  and the child document in that array.
you can have multiple children docs attached to a parent doc.
Pull Requests Welcome