Skip to content
Myr

Merge branch 'master' of github.com:visionmedia/express

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

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parents 1820ea6, 6b2ec50 · Browse files · 3 files+7 added−7 removed
This commit

State

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

Diff stats

3 files+7 added−7 removed

  • other:+7 added−7 removed

3 files+7 added−7 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
modified:docs/guide.md+2 added-2 removed
613 unmodified lines
614 app.use(express.session({ secret: "keyboard cat" }));615616By default the _session_ middleware uses the memory store bundled with Connect, however many implementations exist. For example [connect-redis](http://github.com/visionmedia/connect-redis) supplies a [Redis](http://code.google.com/p/redis/) session store and can be used as shown below:617618 var RedisStore = require('connect-redis');618 var RedisStore = require('connect-redis')(express);619 app.use(express.cookieParser());620 app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));621622Now the _req.session_ and _req.sessionStore_ properties will be accessible to all routes and subsequent middleware. Properties on _req.session_ are automatically saved on a response, so for example if we wish to shopping cart data:623624 var RedisStore = require('connect-redis');624 var RedisStore = require('connect-redis')(express);625 app.use(express.bodyParser());626 app.use(express.cookieParser());627 app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));628
755 unmodified lines
modified:docs/migrate.md+3 added-3 removed