Simple CouchDB wrapper for Request
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A really minimal CouchDB client module that adds just one level of abstraction on top of Request.


npm install couch-request


Require the module:

var couchrequest = require('couch-request');

Configure the database:

var database = couchrequest( {databaseUrl: [DATABASE URL] } );

Example DATABASE URL if you want to use CouchDB running on localhost:

Get data:

database( path, callback(err, results) );

database("_all_docs", function(err, results){
    if( err ) {
        // an error occurred
    } else{
        // do stuff with results

Post data:

database( path, object(s)ToStore, callback(err, results) );

database("", {name: "peter"}, function(err, data){
    if( err ) {
        // an error occurred
    } else{
        // do stuff with results

As you can see getting and posting stuff to and from the database is fairly simple.

The database function takes two or three arguments. If you provide two (the path and callback) couch-request will make a GET request for you. If you provide three (path, the object and callback), couch-request will make a POST request for you, posting the object passed in as the request body.

Copyright (c) 2013 Peter Koraca


Have fun,