Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janl/couchr
Lightweight CouchDB request library for Node and the browser
https://github.com/janl/couchr
Last synced: 3 months ago
JSON representation
Lightweight CouchDB request library for Node and the browser
- Host: GitHub
- URL: https://github.com/janl/couchr
- Owner: janl
- Fork: true (caolan/couchr)
- Created: 2014-08-19T08:13:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-19T08:35:32.000Z (over 10 years ago)
- Last Synced: 2024-04-07T01:27:38.109Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```javascript
// 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
```javascript
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](http://jamjs.org)):
jam install couchr
Node (using [npm](http://npmjs.org)):
npm install couchr