couchr

0.0.16 • Public • Published

couchr

Simple request library for CouchDB. Provides both a Node.js module and a browser module (based on jQuery.ajax), with better CouchDB error reporting and a simpler API than making XHR requests directly in the browser.

Examples

// browser
require(['couchr'], function (couchr) {
    couchr.get('/dbname/docid', function (err, doc) {
        ...
    });
});
 
// Node
var couchr = require('couchr');
couchr.get('http://hostname:port/dbname/docid', function (err, doc) {
    ...
});

Methods

couchr.get (url, /*optional*/params, function (err, res, req) { ... })
couchr.post(url, /*optional*/data,   function (err, res, req) { ... })
couchr.put (url, /*optional*/data,   function (err, res, req) { ... })
couchr.del (url, /*optional*/data,   function (err, res, req) { ... })
couchr.head(url, function (err, res, req) { ... })
 
couchr.copy(from, to, function (err, res, req) { ... }) 
 
var feed = couchr.changes(db_url);
feed.on('change', function (change_object) { ...  });
feed.on('error', function (err) { ...  });
feed.pause();
feed.resume();

Installation

Browser (using jam):

jam install couchr

Node (using npm):

npm install couchr

Dependents (16)

Package Sidebar

Install

npm i couchr

Weekly Downloads

9

Version

0.0.16

License

none

Last publish

Collaborators

  • caolan