Giter Site home page Giter Site logo

connect-couchdb's Introduction

Connect CouchDB

connect-couchdb is a middleware session store for the connect framework. Build Status

Requirements

  • couchdb 1.2.x
  • cradle 0.6.x : the couchdb wrapper. Should be easy to use another one.
  • mocha (only for tests)

Installation

Via npm:

$ npm install connect-couchdb

Usage

var connect = require('connect'),
    ConnectCouchDB = require('connect-couchdb')(connect);

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.createServer();
server.use(connect.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

connect-couchdb's People

Contributors

tdebarochez avatar ianshward avatar ryankirkman avatar alappe avatar cliffano avatar wankdanker avatar danbell avatar kkaefer avatar masylum avatar qraynaud avatar

Watchers

James Cloos avatar Valtteri Virtanen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.