A light weight library for connecting to CouchDB that works in both Node and the browser.
npm install sag
|9||downloads in the last month|
|Version||0.4.0 last updated 9 months ago|
|Keywords||couchdb, couch, cloudant, iriscouch, database, nosql, ajax, network, networking, http, rest|
Version 0.4.0 http://www.saggingcouch.com
Sag is designed to not force any particular programming method on its users - you just pass objects in and get objects back. This makes it trivial to include Sag in your application, build different functionality on top of it, and expand Sag to include new CouchDB functionality.
npm install sag or include the source file in your project.
Browser: Include the source file in your project and embed it with a script tag.
Sag-JS is API compatible with Sag 0.7.1 with a few asynchronous language specific additions.
Each release is tested with an automated testing suite against these combinations of software:
Apache CouchDB: 1.1.x, 1.2.x, 1.3.x
Node.JS: 0.8.x and 0.10.x (stable releases only)
Browsers: FF >= 3.5, Chrome >= 15, and IE >= 7
Lower versions will likely work with Sag-JS but are not officially supported, so your mileage may vary.
CHANGELOG A detailed list of all changes between releases, including any breaking changes.
LICENSE A copy of the license Sag-JS is released under.
NOTICE Copyright notices.
README This file.
Makefile Used to run unit tests, create releases, etc.
src/ This directory contains the pieces of source
code tha will be combined to make the sag.js
file. If you are building from source, then
make to generate the file.
tests/ Contains the automated testing suite for Sag-JS and its own documentation.
Sag's paradigm of simplicity is carried into its error handling by allowing you to send data to CouchDB that will result in errors (ex., malformed JSON). This is because CouchDB knows when there is an error better than Sag. This also makes Sag more future proof, instead of worrying about each of CouchDB's API changes. Therefore, Sag will only look for Sag-JS interface problems and issues that are native to JS, such as passing an int instead of a string.
All local errors are floated back to your application with exceptions. Sag does not catch any errors itself, allowing your application to care about them or not.
CouchDB errors will be exposed through the response object. Additionally the
second parameter of the callback functions is set to
true if a non-2xx HTTP
status was returned.
Sag-JS automatically detects whether it is in a Node.JS or browser environment and selects which networking tools to use accordingly.
Node.JS uses the HTTP module found in every Node.JS release.
Browser current uses XHR, which makes cross domain requests unfeasible. Future versions will include support for cross domain requests.
Detailed documentation of the functions and API are available at http://www.saggingcouch.com
Sag-JS is released under the Apache License, version 2.0. See the file named LICENSE for more information.
Copyright information is in the NOTICE file.