node package manager

now-sessions

Uses now-middleware for NowJS to enable HTTP session lookup from a Connect-compliant session store when a new nowjs session is created.

NowJS Connect HTTP Session Injection

To enable:

var nowjs = require('now'); require('now-sessions')(nowjs);

To activate, when you're ready:

nowjs.sessions( sessionStore, sessionKey );

For example:


// Session Store
var MemoryStore = require('express/node_modules/connect/lib/middleware/session').MemoryStore;
app.SessionStore = new MemoryStore({ reapInterval: 60000 * 10 });

nowjs.sessions(app.SessionStore);

Parameters are:

  • the Connect-compliant SessionStore you are using (really the session store just needs to support the .get() method)
  • the connect session key you are using to store the session id in the user's cookie, default is 'connect.sid' if you omit this parameter