Socket
Socket
Sign inDemoInstall

couchr-browser

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    couchr-browser

Lightweight library for making CouchDB requests in the browser


Version published
Maintainers
1
Install size
9.79 kB
Created

Readme

Source

couchr-browser

Lightweight request library for CouchDB. Provides a browser-compatible module, with better CouchDB error reporting and a simpler API than making XHR requests directly in the browser or using jQuery.ajax.

This package is designed to be suitable for use with webpack or browserify, and makes use of the events module (for the changes feed). You can pass in any jQuery.ajax compatible API to initialize the module (allowing you to use your favourite library for this). I suggest taking a look at reqwest if you don't need full jQuery.

Comes in around 5.9kb minified (2.2kb gzipped)

Examples

var couchr = require('couchr-browser')(jQuery.ajax);

couchr.get('http://hostname:port/dbname/docid', function (err, doc) {
    ...
});

Methods

var couchr = require('couchr-browser')(jQuery.ajax);
var couchr = require('couchr-browser')(reqwest.compat);

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

npm install couchr-browser

Building stand-alone version

npm run build

FAQs

Last updated on 11 Sep 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc