1.0.0 • Published 10 years ago

connect-couchdb v1.0.0

Weekly downloads
166
License
-
Repository
-
Last release
10 years ago

Connect CouchDB

connect-couchdb is a storage wrapper for the express-session middleware of connect/ expressjs frameworks. Build Status

Requirements

  • couchdb (tested with v1.5.0)
  • yacw 0.2.x : the couchdb wrapper. Should be easy to use another one.
  • mocha (only for tests)

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 :

$ node tools/setup.js <database_name> <revs_limit> [username] [password]

For more informations about the _revs_limit option, read this.

It is highly recommended that you use a separate database for your sessions for performance of both the session views and any other document views you may have.

See example.js file for an example connect server using connect-couch.

Updating

Please invoke the tool to create the design documents when updating to insure you are using the last version of the view.

$ node tools/put_design_docs.js <database_name> [username] [password]

Tests

$ npm test

Author

Contributors

$ git shortlog -s -n
1.0.0

10 years ago

0.4.2

10 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.2

11 years ago

0.3.1

11 years ago

0.3.0

11 years ago

0.2.5

12 years ago

0.2.4

12 years ago

0.2.3

12 years ago

0.2.2

13 years ago

0.2.1

13 years ago

0.2.0

13 years ago

0.1.1

13 years ago

0.1.0

13 years ago