Requirements

Compatibility

For node v0.10, Connect v3 and Express v4 you must use the master branch.
For olders node version, use others branches.

Installation

Via npm:

$ npm install connect-couchdb --save

Usage

var session = require('express-session'),
connect = require('connect');
ConnectCouchDB = require('connect-couchdb')(session);
var store = new ConnectCouchDB({
// Name of the database you would like to use for sessions.
name: 'myapp-sessions',
// Optional. How often expired sessions should be cleaned up.
// Defaults to 600000 (10 minutes).
reapInterval: 600000,
// Optional. How often to run DB compaction against the session
// database. Defaults to 300000 (5 minutes).
// To disable compaction, set compactInterval to -1
compactInterval: 300000,
// Optional. How many time between two identical session store
// Defaults to 60000 (1 minute)
setThrottle: 60000
});
var server = connect();
server.use(session({secret: 'YourSecretKey', store: store });

If the database specified doesn't already exist you have to create it with
tools/ files. Run following command to create database, populate with the
design document and setup the CouchDB database specific option _revs_limit :