Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed connect-redis example

  • Loading branch information...
commit 8f87c503200c9b1684a1c4aa6f8e30bb1d9d891a 1 parent ee4471b
TJ Holowaychuk tj authored
Showing with 17 additions and 12 deletions.
  1. +17 −12 examples/session/redis.js
29 examples/session/redis.js
View
@@ -5,21 +5,26 @@
var express = require('../../lib/express');
-// $ npm install connect-redis
-var RedisStore = require('connect-redis');
+// pass the express to the connect redis module
+// allowing it to inherit from express.session.Store
+var RedisStore = require('connect-redis')(express);
-var app = express.createServer(
- express.logger(),
+var app = express.createServer();
- // Required by session() middleware
- express.cookieParser(),
+app.use(express.favicon());
- // Populates:
- // - req.session
- // - req.sessionStore
- // - req.sessionID (or req.session.id)
- express.session({ secret: 'keyboard cat', store: new RedisStore })
-);
+// request logging
+app.use(express.logger());
+
+// required to parse the session cookie
+app.use(express.cookieParser());
+
+// Populates:
+// - req.session
+// - req.sessionStore
+// - req.sessionID (or req.session.id)
+
+app.use(express.session({ secret: 'keyboard cat', store: new RedisStore }));
app.get('/', function(req, res){
var body = '';
Please sign in to comment.
Something went wrong with that request. Please try again.