Interface to CouchDB that allows the control of permissions on the documents
Last updated a month ago by stropitek .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install rest-on-couch 
SYNC missed versions from official npm registry.


NPM version build status David deps npm download Known Vulnerabilities

Interface to CouchDB that allows the control of permissions on the documents.


API documentation


The configuration is being read on load from many sources, in the following order (ascending priority):

  1. Default configuration. Some configuration elements have default values. They are defined in the source code
  2. Main configuration file (config.js or config.json in ROC's home directory)
  3. Database configuration file (config.js in database's subdirectory)
  4. Environment variable (uppercase snake-case with REST_ON_COUCH_ prefix)
  5. Custom config file passed with --config in the CLI

Main options


Type: string
Default: 'http://localhost:5984'
URL of the CouchDB server.


Type: string
Default: undefined
Username for CouchDB connection.


Type: string
Default: undefined
Password for CouchDB connection.


Type: string
Default: 'WARN'
Level of the logs stored in the database. Possible values are FATAL (1), ERROR (2), WARN (3), INFO (4), DEBUG (5) and TRACE (6). Logs are only inserted if the current level is equal or higher to the log's level.


Type: number
Default: 570
Time in seconds that the application waits before revalidating the session with CouchDB. This number should be smaller than the session's cookie life.


Type: boolean
Default: false
If set to true, the application will try to automatically create the database on CouchDB if it is missing.

Server options


Type: number
Default: 3000
Port used by the rest-on-couch server.


Type: object
Default: {couchdb:{}}
Object describing the authentication strategies that are available and providing options to them.


Type: boolean
Default: true
Set to true if your application is behind a proxy and needs to trust X-Forwarded- headers.


Type: string
Default: '/'
If the proxy is not at the root level of the URL, set this value to the corresponding prefix.


Type: array<string>
Default: []
If cross-origin calls need to be done, set the list of trusted origins here.


Type: string
Default: undefined
Domain of the session cookie.


Type: string Default: 'roc:sess' Key of the session cookie.


Type: string Default: '/' Path of the session cookie.


Type: boolean
Default: false
Set to true if the cookie should only be valid on secure URLs.


Type: boolean
Default: false
If set to true, a stack trace will be print to the body of the response when an error occurs.
Do not use this in production!

Setup environment with Docker (for runnings tests)

docker pull couchdb
docker create -p 5984:5984 --name couchdb -v /your/local/path/of/choice:/opt/couchdb/data couchdb
docker start couchdb
docker ps # check that the container is running

Go to http://localhost:

  • Single node
  • username: admin, password: admin
  • bind address:
  • Execute the bash script /
  • Execute the tests: npm t



Today 0
This Week 38
This Month 38
Last Day 38
Last Week 0
Last Month 65
Dependencies (54)
Dependents (1)

Copyright 2014 - 2016 © |