Skip to content
Myr

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

2 files+68 added−2 removed

modified:docs/migrate.1+44 added-1 removed
182 unmodified lines
183.184.P185The \fIstream threshold\fR setting was removed\.186.187.SS "res\.render()"188Previously locals were passed as a separate key:189.190.IP "" 4191.192.nf193194 res\.render(\'user\', { layout: false, locals: { user: user }});195.196.fi197.198.IP "" 0199.200.P201In 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.nf206207 res\.render(\'user\', { layout: false, user: user });208.209.fi210.211.IP "" 0212.213.SS "res\.partial()"214Express 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.nf219220 // render a collection of comments221 res\.partial(\'comment\', [comment1, comment2]);222223 // render a single comment224 res\.partial(\'comment\', comment);225.226.fi227.228.IP "" 0229.187.SS "View Engine Compliance"230.SS "Template Engine Compliance"231To comply with Express previously engines needed the following signature:232.233.IP "" 4234.
38 unmodified lines
modified:docs/migrate.html+24 added-1 removed
304 unmodified lines
305</code></pre>306307<p> The <em>stream threshold</em> setting was removed.</p>308309<h3 id="View-Engine-Compliance">View Engine Compliance</h3>309<h3 id="res-render-">res.render()</h3>310311<p> Previously locals were passed as a separate key:</p>312313<pre><code> res.render('user', { layout: false, locals: { user: user }});314</code></pre>315316<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>317318<pre><code> res.render('user', { layout: false, user: user });319</code></pre>320321<h3 id="res-partial-">res.partial()</h3>322323<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>324325<pre><code> // render a collection of comments326 res.partial('comment', [comment1, comment2]); 327328 // render a single comment329 res.partial('comment', comment);330</code></pre>331332<h3 id="Template-Engine-Compliance">Template Engine Compliance</h3>333334<p> To comply with Express previously engines needed the following signature:</p>335336<pre><code> engine.render(str, options, function(err){});337</code></pre>
23 unmodified lines