Skip to content
Myr

Due to npm 1.x changes need to pass connect/express to the function connect-redis exports (see https://github.com/visionmedia/connect-redis)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jake Gordon · committed by Jake Gordon · parent 9028cac · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:docs/guide.html+2 added-2 removed
929 unmodified lines
930</code></pre>931932<p>By default the <em>session</em> middleware uses the memory store bundled with Connect, however many implementations exist. For example <a href="http://github.com/visionmedia/connect-redis">connect-redis</a> supplies a <a href="http://code.google.com/p/redis/">Redis</a> session store and can be used as shown below:</p>933934<pre><code>var RedisStore = require('connect-redis');934<pre><code>var RedisStore = require('connect-redis')(express);935app.use(express.cookieParser());936app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));937</code></pre>938939<p>Now the <em>req.session</em> and <em>req.sessionStore</em> properties will be accessible to all routes and subsequent middleware. Properties on <em>req.session</em> are automatically saved on a response, so for example if we wish to shopping cart data:</p>940941<pre><code>var RedisStore = require('connect-redis');941<pre><code>var RedisStore = require('connect-redis')(express);942app.use(express.bodyParser());943app.use(express.cookieParser());944app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));945
846 unmodified lines