docs
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 · parent 07ce5d3 · Browse files · 2 files·+68 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
2 files+68 added−2 removed
- other:+68 added−2 removed
Provenance
- Commit
2bb0412- Tree
4826085- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
07ce5d3
2 files changed+68 added−2 removed
modified:docs/migrate.1+44 added-1 removed
182 unmodified lines183 .184 .P185 The \fIstream threshold\fR setting was removed\.186 .187+.SS "res\.render()"188+Previously locals were passed as a separate key:189+.190+.IP "" 4191+.192+.nf193+194+ res\.render(\'user\', { layout: false, locals: { user: user }});195+.196+.fi197+.198+.IP "" 0199+.200+.P201+In Express 2\.0 both the locals and the options are one in the same, meaning you cannot have a local variable named \fIlayout\fR as it is reserved for express, however this cleans up the API:202+.203+.IP "" 4204+.205+.nf206+207+ res\.render(\'user\', { layout: false, user: user });208+.209+.fi210+.211+.IP "" 0212+.213+.SS "res\.partial()"214+Express 2\.0 adds the \fIres\.partial()\fR method, helpful for rendering partial fragments over WebSockets or Ajax requests etc\. The API is identical to the \fIpartial()\fR calls within views\.215+.216+.IP "" 4217+.218+.nf219+220+ // render a collection of comments221+ res\.partial(\'comment\', [comment1, comment2]);222+223+ // render a single comment224+ res\.partial(\'comment\', comment);225+.226+.fi227+.228+.IP "" 0229+.187-.SS "View Engine Compliance"230+.SS "Template Engine Compliance"231 To comply with Express previously engines needed the following signature:232 .233 .IP "" 4234 .38 unmodified linesmodified:docs/migrate.html+24 added-1 removed
304 unmodified lines305 </code></pre>306 307 <p> The <em>stream threshold</em> setting was removed.</p>308 309-<h3 id="View-Engine-Compliance">View Engine Compliance</h3>309+<h3 id="res-render-">res.render()</h3>310 311+<p> Previously locals were passed as a separate key:</p>312+313+<pre><code> res.render('user', { layout: false, locals: { user: user }});314+</code></pre>315+316+<p> In Express 2.0 both the locals and the options are one in the same, meaning you cannot have a local variable named <em>layout</em> as it is reserved for express, however this cleans up the API:</p>317+318+<pre><code> res.render('user', { layout: false, user: user });319+</code></pre>320+321+<h3 id="res-partial-">res.partial()</h3>322+323+<p> Express 2.0 adds the <em>res.partial()</em> method, helpful for rendering partial fragments over WebSockets or Ajax requests etc. The API is identical to the <em>partial()</em> calls within views.</p>324+325+<pre><code> // render a collection of comments326+ res.partial('comment', [comment1, comment2]); 327+328+ // render a single comment329+ res.partial('comment', comment);330+</code></pre>331+332+<h3 id="Template-Engine-Compliance">Template Engine Compliance</h3>333+334 <p> To comply with Express previously engines needed the following signature:</p>335 336 <pre><code> engine.render(str, options, function(err){});337 </code></pre>23 unmodified lines