node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป

connect-sessionvoc

Connect SessionVOC

connect-sessionvoc is a session store using a secure, reliable, external session database, the SessionVOC (see https://github.com/triAGENS/SessionVoc-OPEN).

Installation

via npm:

  $ npm install connect-sessionvoc

Options

  • host hostname of the SessionVOC server, defaults to localhost
  • port port of the SessionVOC server, defaults to 8208

Example

var connect = require('connect'), sessionvoc = require('../lib/sessionvoc');

connect(connect.cookieParser(), sessionvoc(), function(req, res, next) { var sess = req.session;

    if (! sess.superAttribute) {
      sess.superAttribute = { 'counter': 1 };
    }

    sess.superAttribute.counter++;

    if (sess.message) {
      res.setHeader('Content-Type', 'text/html');
      res.write('<p>Message: ' + sess.message + '</p>');
      res.write('<p>Counter: ' + sess.superAttribute.counter + '</p>');
      sess.message = null;
      res.end();
    }
    else {
      sess.message = "DEMO";
      res.end('welcome to the session demo. refresh!');
    }
  }).listen(3000);