0.1.0 • Published 10 years ago
connect-redsess v0.1.0
connect-redsess
Redis session middleware for Connect/Express using Redsess.
Installation
npm install connect-redsess
Usage
var connect = require('connect');
var connectRedsess = require('connect-redsess');
var app = connect();
app.use(connectRedsess());
By default, the middleware will set the Redsess object onto req.session
.
req.session.get('auth', function (err, auth) {
if (!auth) {
// redirect to login page
} else {
// validate
}
});
Constructor Options
connectRedsess(options);
Pass an object to connect-redsess on instantiation with any of Redsess' options as well as the following addition(s):
- requestKey
String
The key at which to attach the Redsess object onto thereq
object. Defaults tosession
.
req.redsessOptions
You may also attach an object onto the req
at req.redsessOptions
with the same options as above. This is useful for any options that are set
per-request (cookies
, token
, etc.). These will override any previously set.
req.redsessOptions = {
cookies: req.cookies
};
0.1.0
10 years ago