var clerk = ;var client = ;var db = client;db;// if a Promise implementation is available, you may leave out the callbackvar promise = dbpromise;
Full documentation at http://mikepb.github.io/clerk/
For more information about promises, see this Mozilla documentation.
$ npm install clerk
Browser support is provided by superagent. The browser versions of the
library may be found under the
dist/ directory. The browser files are updated
on each versioned release, but not for development. Modern browsers are
generally supported, but not widely tested. Karma is used to run the
mocha tests in the browser.
Security restrictions on cross-domain requests currently limits the usefulness of the browser version. Using a local proxy or configuring Cross-Origin Resource Sharing in CouchDB may allow you to use the library in the browser. Please see the configuration notes in the testing section for more information about CouchDB CORS support.
To build the client files:
$ npm run dist
To run tests in node:
$ npm test
To run tests with Karma, make sure that you have enabled cors in
CouchDB. By default, CouchDB does not allow the
header, so if you will be authenticating, you'll need to add it to the list as
[httpd] enable_cors = true [cors] credentials = true origins = * headers = Accept, Accept-Language, Authorization, Content-Length, Content-Range, Content-Type, Destination, Expires, If-Match, Last-Modified, Origin, Pragma, X-Requested-With, X-Http-Method-Override
Then, you may run Karma:
$ npm run karma
The library API generally follows the RESTful API, so you can use the CouchDB
docs as well as the clerk docs to build your applications. If a feature is
missing from clerk or you need to access more advanced features, the
request method allows you to send custom requests directly to CouchDB.
Copyright 2012-2015 Michael Phan-Ba <email@example.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.