Simple Session Store for Connect() Framework session Middleware that leverages an existing connection from MongoSkin
We were using a connect-mongodb
which was working great, however we want to keep our connection pool centralized,
have the benefits that an abstraction layer like mongoskin provides and avoid going twice through the pain
of getting our ReplSetCluster configuration in place.
Use git clone
to download the source and make it available in your project wirh npm link
.
or
npm install connect-mongoskin
This session store is build to work with Connect() Framework / ExpressJS() Framework / RailwayJS() Framework Use it like any other middleware.
The lib reuses an existing client, so pass in the SkinDb and options if needed.
var SkinStore = new SkinStore(`db`, `options`[, callback]);
var express = require('express'),
db = require('mongoskin').db(`your_connection_here`),
SkinStore = require('connect-mongoskin');
var app = express.createServer();
app.use(express.cookieParser());
app.use(express.session({cookie: { secure: false, maxAge:86400000 }, store: new SkinStore(`db`)}));
Originally written by @johnnyhalife (johnny at mural.ly)