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
Provenance
- Commit
48a14a4- Tree
a93a3e3- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent 1
1820ea6- Parent 2
6b2ec50
3 files changed+7 added−7 removed
modified:docs/guide.html+2 added-2 removed
929 unmodified lines930 </code></pre>931 932 <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>933 934-<pre><code>var RedisStore = require('connect-redis');934+<pre><code>var RedisStore = require('connect-redis')(express);935 app.use(express.cookieParser());936 app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));937 </code></pre>938 939 <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>940 941-<pre><code>var RedisStore = require('connect-redis');941+<pre><code>var RedisStore = require('connect-redis')(express);942 app.use(express.bodyParser());943 app.use(express.cookieParser());944 app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));945 846 unmodified linesmodified:docs/guide.md+2 added-2 removed
613 unmodified lines614 app.use(express.session({ secret: "keyboard cat" }));615 616 By 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:617 618- 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 }));621 622 Now 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:623 624- 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 linesmodified:docs/migrate.md+3 added-3 removed
121 unmodified linesExpand all12212312412512612612712812913025 unmodified lines1561571581591601601611621631648 unmodified lines173174175176177177121 unmodified linesExpand all res.partial('comment', comment);
### partial() locals
Both _res.partial()_ and the _partial()_ functions accept an single object consisting of both the options and the locals. Previously with Express 1.x you may pass _user_ to a partial, along with _date_ like so: Both _res.partial()_ and the _partial()_ functions accept a single object consisting of both the options and the locals. Previously with Express 1.x you may pass _user_ to a partial, along with _date_ like so: partial('user', { object: user, locals: { date: new Date }})
or perhaps if you preferred not to use the inferred name _user_ you may used a local for this as well:25 unmodified lines fn(locals);
### View Partial Lookup
Previously partials were loaded relative to the now removed _view partials_ directory setting, or by default _views/partials_, now they are relative to the view calling them, read more on [view lookup](guide.html#View-Lookup). Previously partials were loaded relative to the now removed _view partials_ directory setting, or by default _views/partials_, now they are relative to the view calling them, read more on [view lookup](guide.html#view-lookup).
### Mime Types
Express and Connect now utilize the _mime_ module in npm, so to add more use:8 unmodified lines
Previously when using options the `root` option would be used for this:
app.use(express.staticProvider({ root: __dirname + '/public', maxAge: oneYear })); No newline at end of file