Skip to content
Myr

Updated 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 f60bcca · Browse files · 7 files+121 added−118 removed
This commit

State

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

Diff stats

7 files+121 added−118 removed

  • other:+121 added−118 removed

7 files+121 added−118 removed

modified:docs/api.html+46 added-48 removed
262 unmodified lines
263</td>264<td class="code">265<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">param</span> = <span class="keyword">function</span>(<span class="variable">name</span>){266 <span class="comment">// Route params like /user/:id</span>267 <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>.<span class="variable">path</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {268 <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>.<span class="variable">path</span>[<span class="variable">name</span>]; 267 <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {268 <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>[<span class="variable">name</span>]; 269 }270 <span class="comment">// Query string params</span>271 <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>.<span class="variable">get</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {272 <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>.<span class="variable">get</span>[<span class="variable">name</span>]; 271 <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">query</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {272 <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">query</span>[<span class="variable">name</span>]; 273 }274 <span class="comment">// Request body params via connect.bodyDecoder</span>275 <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">body</span> &<span class="variable">amp</span>;&<span class="variable">amp</span>; <span class="this">this</span>.<span class="variable">body</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {276 <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">body</span>[<span class="variable">name</span>];
59 unmodified lines
336<td class="code">337<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">__defineGetter__</span>(<span class="string">'isXMLHttpRequest'</span>, <span class="variable">isxhr</span>);338<span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">__defineGetter__</span>(<span class="string">'xhr'</span>, <span class="variable">isxhr</span>);</code></pre>339</td>340</tr><tr class="filename"><td><h2 id="lib/express/utils.js"><a href="#">utils</a></h2></td><td>lib/express/utils.js</td></tr><tr class="code">341<td class="docs">342<p>Parse mini markdown implementation.343The following conversions are supported,344primarily for the "flash" middleware:</p>345346<p> <em>foo</em> or <em>foo</em> become &lt;em&gt;foo&lt;/em&gt;347 <strong>foo</strong> or <strong>foo</strong> become &lt;strong&gt;foo&lt;/strong&gt;348 <a href="B">A</a> becomes &lt;a href="B"&gt;A&lt;/a&gt;</p>349350<h2></h2>351352<ul><li><p><strong>param</strong>: <em>String</em> str</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>353</td>354<td class="code">355<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){356 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)357 .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'&lt;strong&gt;$2&lt;/strong&gt;'</span>)358 .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'&lt;em&gt;$2&lt;/em&gt;'</span>)359 .<span class="variable">replace</span>(<span class="regexp">/\[([^\]]+)\]\(([^)]+)\)/g</span>, <span class="string">'&lt;a href=&quot;$2&quot;&gt;$1&lt;/a&gt;'</span>);360};</code></pre>361</td>362</tr>363<tr class="code">364<td class="docs">365<p>Escape special characters in the given string of html.</p>366367<h2></h2>368369<ul><li><p><strong>param</strong>: <em>String</em> html</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>370</td>371<td class="code">372<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {373 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)374 .<span class="variable">replace</span>(<span class="regexp">/&amp;/g</span>, <span class="string">'&amp;'</span>)375 .<span class="variable">replace</span>(<span class="regexp">/&quot;/g</span>, <span class="string">'&quot;'</span>)376 .<span class="variable">replace</span>(<span class="regexp">/&lt;/g</span>, <span class="string">'&lt;'</span>)377 .<span class="variable">replace</span>(<span class="regexp">/&gt;/g</span>, <span class="string">'&gt;'</span>);378};</code></pre>379</td>380</tr><tr class="filename"><td><h2 id="lib/express/response.js"><a href="#">response</a></h2></td><td>lib/express/response.js</td></tr><tr class="code">381<td class="docs">382<p>Module dependencies.383 </p>
276 unmodified lines
660 <span class="this">this</span>.<span class="variable">set</span>(<span class="string">'env'</span>, <span class="variable">process</span>.<span class="variable">env</span>.<span class="class">EXPRESS_ENV</span> || <span class="variable">process</span>.<span class="variable">connectEnv</span>.<span class="variable">name</span>);661662 <span class="comment">// Expose objects to each other</span>663 <span class="this">this</span>.<span class="variable">use</span>(<span class="keyword">function</span>(<span class="variable">req</span>, <span class="variable">res</span>, <span class="variable">next</span>){624 <span class="variable">req</span>.<span class="variable">params</span> = <span class="variable">req</span>.<span class="variable">params</span> || {};625 <span class="variable">req</span>.<span class="variable">params</span>.<span class="variable">get</span> = {};664 <span class="variable">req</span>.<span class="variable">query</span> = {};665 <span class="variable">res</span>.<span class="variable">headers</span> = {};666 <span class="variable">req</span>.<span class="variable">app</span> = <span class="variable">res</span>.<span class="variable">app</span> = <span class="variable">self</span>;667 <span class="variable">req</span>.<span class="variable">res</span> = <span class="variable">res</span>;668 <span class="variable">res</span>.<span class="variable">req</span> = <span class="variable">req</span>;669 <span class="variable">req</span>.<span class="variable">next</span> = <span class="variable">next</span>;670 <span class="comment">// Assign req.params.get</span>671 <span class="keyword">if</span> (<span class="variable">req</span>.<span class="variable">url</span>.<span class="variable">indexOf</span>(<span class="string">'?'</span>) &<span class="variable">gt</span>; <span class="number integer">0</span>) {633 <span class="comment">// TODO: consider simple substr to increase performance</span>672 <span class="keyword">var</span> <span class="variable">query</span> = <span class="variable">url</span>.<span class="variable">parse</span>(<span class="variable">req</span>.<span class="variable">url</span>).<span class="variable">query</span>;635 <span class="variable">req</span>.<span class="variable">params</span>.<span class="variable">get</span> = <span class="variable">queryString</span>.<span class="variable">parse</span>(<span class="variable">query</span>);673 <span class="variable">req</span>.<span class="variable">query</span> = <span class="variable">queryString</span>.<span class="variable">parse</span>(<span class="variable">query</span>);674 }675 <span class="variable">next</span>();676 });677
236 unmodified lines
914 <span class="keyword">return</span> <span class="variable">arguments</span>.<span class="variable">callee</span>;915})(<span class="string">'get'</span>)(<span class="string">'post'</span>)(<span class="string">'put'</span>)(<span class="string">'del'</span>);916</code></pre>917</td>880</tr><tr class="filename"><td><h2 id="lib/express/utils.js"><a href="#">utils</a></h2></td><td>lib/express/utils.js</td></tr><tr class="code">881<td class="docs">882<p>Parse mini markdown implementation.883The following conversions are supported,884primarily for the "flash" middleware:</p>885886<p> <em>foo</em> or <em>foo</em> become &lt;em&gt;foo&lt;/em&gt;887 <strong>foo</strong> or <strong>foo</strong> become &lt;strong&gt;foo&lt;/strong&gt;888 <a href="B">A</a> becomes &lt;a href="B"&gt;A&lt;/a&gt;</p>889890<h2></h2>891892<ul><li><p><strong>param</strong>: <em>String</em> str</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>893</td>894<td class="code">895<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){896 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)897 .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'&lt;strong&gt;$2&lt;/strong&gt;'</span>)898 .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'&lt;em&gt;$2&lt;/em&gt;'</span>)899 .<span class="variable">replace</span>(<span class="regexp">/\[([^\]]+)\]\(([^)]+)\)/g</span>, <span class="string">'&lt;a href=&quot;$2&quot;&gt;$1&lt;/a&gt;'</span>);900};</code></pre>901</td>902</tr>903<tr class="code">904<td class="docs">905<p>Escape special characters in the given string of html.</p>906907<h2></h2>908909<ul><li><p><strong>param</strong>: <em>String</em> html</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>910</td>911<td class="code">912<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {913 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)914 .<span class="variable">replace</span>(<span class="regexp">/&amp;/g</span>, <span class="string">'&amp;'</span>)915 .<span class="variable">replace</span>(<span class="regexp">/&quot;/g</span>, <span class="string">'&quot;'</span>)916 .<span class="variable">replace</span>(<span class="regexp">/&lt;/g</span>, <span class="string">'&lt;'</span>)917 .<span class="variable">replace</span>(<span class="regexp">/&gt;/g</span>, <span class="string">'&gt;'</span>);918};</code></pre>919</td>918</tr><tr class="filename"><td><h2 id="lib/express/view.js"><a href="#">view</a></h2></td><td>lib/express/view.js</td></tr><tr class="code">919<td class="docs">920<p>Module dependencies.921 </p>
231 unmodified lines
modified:docs/guide.1+18 added-17 removed
148 unmodified lines
149.150.IP "" 0151.152.SS "Routing"153Express utilizes the HTTP verbs to provide a meaningful, expressive routing API\. For example we may want to render a user\'s account for the path \fI/user/12\fR, this can be done by defining the route below\. The values associated to the named placeholders, are passed as the \fIthird\fR argument, which here we name \fIparams\fR\.153Express utilizes the HTTP verbs to provide a meaningful, expressive routing API\. For example we may want to render a user\'s account for the path \fI/user/12\fR, this can be done by defining the route below\. The values associated to the named placeholders are available as \fBreq\.params\fR\.154.155.IP "" 4156.157.nf158159app\.get(\'/user/:id\', function(req, res, params){160 res\.send(\'user \' + params\.id);159app\.get(\'/user/:id\', function(req, res){160 res\.send(\'user \' + req\.params\.id);161});162.163.fi164.
12 unmodified lines
177.178.IP "" 0179.180.P181Regular expression literals may also be passed for complex uses\. Since capture groups with literal \fIRegExp\fR\'s are anonymous we can access them directly from the \fIparams\fR array\.181Regular expression literals may also be passed for complex uses\. Since capture groups with literal \fIRegExp\fR\'s are anonymous we can access them directly \fBreq\.params\fR\.182.183.IP "" 4184.185.nf186187app\.get(/^\\/users?(?:\\/(\\d+)(?:\\\.\\\.(\\d+))?)?/, function(req, res, params){188 res\.send(params);187app\.get(/^\\/users?(?:\\/(\\d+)(?:\\\.\\\.(\\d+))?)?/, function(req, res){188 res\.send(req\.params);189});190.191.fi192.
58 unmodified lines
251.252.IP "" 0253.254.SS "Passing Route Control"255We may pass control to the next \fImatching\fR route, by calling the \fIfourth\fR parameter, the \fInext()\fR function\. When a match cannot be made, control is passed back to Connect\.255We may pass control to the next \fImatching\fR route, by calling the \fIthird\fR argument, the \fInext()\fR function\. When a match cannot be made, control is passed back to Connect, and middleware continue to be invoked\.256.257.IP "" 4258.259.nf260261app\.get(\'/users/:id?\', function(req, res, params){262 if (params\.id) {261app\.get(\'/users/:id?\', function(req, res){262 var id = req\.params\.id;263 if (id) {264 // do something265 } else {266 next();267 }268});269269app\.get(\'/users\', function(req, res, params){270app\.get(\'/users\', function(req, res){271 // do something else272});273.274.fi
312 unmodified lines
587.SS "req\.param(name)"588Return the value of param \fIname\fR when present\.589.590.IP "\(bu" 4590Checks route placeholders, ex: /user/:id591Checks route placeholders (\fIreq\.params\fR), ex: /user/:id592.593.IP "\(bu" 4593Checks query string params, ex: ?id=12594Checks query string params (\fIreq\.query\fR), ex: ?id=12595.596.IP "\(bu" 4596Checks urlencoded body params, ex: id=12597Checks urlencoded body params (\fIreq\.body\fR), ex: id=12598.599.IP "" 0600.601.P
361 unmodified lines
963.IP "" 4964.965.nf966966app\.redirect(\'comments\', function(req, res, params){967 return \'/post/\' + params\.id + \'/comments\';967app\.redirect(\'comments\', function(req, res){968 return \'/post/\' + req\.params\.id + \'/comments\';969});970.971.fi972.
59 unmodified lines
1032.1033.IP "" 01034.1035.SS "app\.dynamicHelpers(obj)"1035Registers dynamic view helpers\. Dynamic view helpers are simply functions which accept \fIreq\fR, \fIres\fR, and \fIparams\fR, and are evaluated against the \fIServer\fR instance before a view is rendered\. The \fIreturn value\fR of this function becomes the local variable it is associated with\.1036Registers dynamic view helpers\. Dynamic view helpers are simply functions which accept \fIreq\fR, \fIres\fR, and are evaluated against the \fIServer\fR instance before a view is rendered\. The \fIreturn value\fR of this function becomes the local variable it is associated with\.1037.1038.IP "" 41039.1040.nf10411042app\.dynamicHelpers({1042 session: function(req, res, params){1043 session: function(req, res){1044 return req\.session;1045 }1046});1047.
86 unmodified lines
modified:docs/guide.html+21 added-19 removed
327 unmodified lines
328<h3 id="Routing">Routing</h3>329330<p>Express utilizes the HTTP verbs to provide a meaningful, expressive routing API.331For example we may want to render a user's account for the path <em>/user/12</em>, this332can be done by defining the route below. The values associated to the named placeholders,333are passed as the <em>third</em> argument, which here we name <em>params</em>.</p>332can be done by defining the route below. The values associated to the named placeholders333are available as <code>req.params</code>.</p>334335<pre><code>app.get('/user/:id', function(req, res, params){336 res.send('user ' + params.id);335<pre><code>app.get('/user/:id', function(req, res){336 res.send('user ' + req.params.id);337});338</code></pre>339340<p>A route is simple a string which is compiled to a <em>RegExp</em> internally. For example
2 unmodified lines
343<pre><code>\/user\/([^\/]+)\/?344</code></pre>345346<p>Regular expression literals may also be passed for complex uses. Since capture347groups with literal <em>RegExp</em>'s are anonymous we can access them directly from the <em>params</em> array.</p>347groups with literal <em>RegExp</em>'s are anonymous we can access them directly <code>req.params</code>.</p>348349<pre><code>app.get(/^\/users?(?:\/(\d+)(?:\.\.(\d+))?)?/, function(req, res, params){350 res.send(params);349<pre><code>app.get(/^\/users?(?:\/(\d+)(?:\.\.(\d+))?)?/, function(req, res){350 res.send(req.params);351});352</code></pre>353354<p>Curl requests against the previously defined route:</p>
41 unmodified lines
396</code></pre>397398<h3 id="Passing-Route-Control">Passing Route Control</h3>399400<p>We may pass control to the next <em>matching</em> route, by calling the <em>fourth</em> parameter,401the <em>next()</em> function. When a match cannot be made, control is passed back to Connect.</p>400<p>We may pass control to the next <em>matching</em> route, by calling the <em>third</em> argument,401the <em>next()</em> function. When a match cannot be made, control is passed back to Connect,402and middleware continue to be invoked.</p>403403<pre><code>app.get('/users/:id?', function(req, res, params){404 if (params.id) {404<pre><code>app.get('/users/:id?', function(req, res){405 var id = req.params.id;406 if (id) {407 // do something408 } else {409 next();410 }411});412411app.get('/users', function(req, res, params){413app.get('/users', function(req, res){414 // do something else415});416</code></pre>417
201 unmodified lines
619620<p>Return the value of param <em>name</em> when present.</p>621622<ul>621<li>Checks route placeholders, ex: /user/:id</li>622<li>Checks query string params, ex: ?id=12</li>623<li>Checks urlencoded body params, ex: id=12</li>623<li>Checks route placeholders (<em>req.params</em>), ex: /user/:id</li>624<li>Checks query string params (<em>req.query</em>), ex: ?id=12</li>625<li>Checks urlencoded body params (<em>req.body</em>), ex: id=12</li>626</ul>627628629<p>To utilize urlencoded request bodies, <em>req.body</em>
235 unmodified lines
865<p> res.redirect('google');</p>866867<p>We may also map dynamic redirects:</p>868867<pre><code>app.redirect('comments', function(req, res, params){868 return '/post/' + params.id + '/comments';869<pre><code>app.redirect('comments', function(req, res){870 return '/post/' + req.params.id + '/comments';871});872</code></pre>873874<p>So now we may do the following, and the redirect will dynamically adjust to
35 unmodified lines
910911<h3 id="app-dynamicHelpers-obj-">app.dynamicHelpers(obj)</h3>912913<p>Registers dynamic view helpers. Dynamic view helpers912are simply functions which accept <em>req</em>, <em>res</em>, and <em>params</em>, and are914are simply functions which accept <em>req</em>, <em>res</em>, and are915evaluated against the <em>Server</em> instance before a view is rendered. The <em>return value</em> of this function916becomes the local variable it is associated with.</p>917918<pre><code>app.dynamicHelpers({917 session: function(req, res, params){919 session: function(req, res){920 return req.session;921 }922});923</code></pre>
53 unmodified lines
modified:docs/guide.md+21 added-19 removed
89 unmodified lines
90### Routing9192Express utilizes the HTTP verbs to provide a meaningful, expressive routing API.93For example we may want to render a user's account for the path _/user/12_, this94can be done by defining the route below. The values associated to the named placeholders,95are passed as the _third_ argument, which here we name _params_.94can be done by defining the route below. The values associated to the named placeholders 95are available as `req.params`.9697 app.get('/user/:id', function(req, res, params){98 res.send('user ' + params.id);97 app.get('/user/:id', function(req, res){98 res.send('user ' + req.params.id);99 });100101A route is simple a string which is compiled to a _RegExp_ internally. For example102when _/user/:id_ is compiled, a simplified version of the regexp may look similar to:103104 \/user\/([^\/]+)\/?105106Regular expression literals may also be passed for complex uses. Since capture107groups with literal _RegExp_'s are anonymous we can access them directly from the _params_ array.107groups with literal _RegExp_'s are anonymous we can access them directly `req.params`.108109 app.get(/^\/users?(?:\/(\d+)(?:\.\.(\d+))?)?/, function(req, res, params){110 res.send(params);109 app.get(/^\/users?(?:\/(\d+)(?:\.\.(\d+))?)?/, function(req, res){110 res.send(req.params);111 });112113Curl requests against the previously defined route:114
38 unmodified lines
153 /products154155### Passing Route Control156157We may pass control to the next _matching_ route, by calling the _fourth_ parameter,158the _next()_ function. When a match cannot be made, control is passed back to Connect.157We may pass control to the next _matching_ route, by calling the _third_ argument,158the _next()_ function. When a match cannot be made, control is passed back to Connect,159and middleware continue to be invoked.160160 app.get('/users/:id?', function(req, res, params){161 if (params.id) {161 app.get('/users/:id?', function(req, res){162 var id = req.params.id;163 if (id) {164 // do something165 } else {166 next();167 }168 });169 168 app.get('/users', function(req, res, params){170 app.get('/users', function(req, res){171 // do something else172 });173174### Middleware
176 unmodified lines
351### req.param(name)352353Return the value of param _name_ when present.354353 - Checks route placeholders, ex: /user/:id354 - Checks query string params, ex: ?id=12355 - Checks urlencoded body params, ex: id=12355 - Checks route placeholders (_req.params_), ex: /user/:id356 - Checks query string params (_req.query_), ex: ?id=12357 - Checks urlencoded body params (_req.body_), ex: id=12358359To utilize urlencoded request bodies, _req.body_360should be an object. This can be done by using361the _connect.bodyDecoder_ middleware.
205 unmodified lines
567 res.redirect('google');568569We may also map dynamic redirects:570569 app.redirect('comments', function(req, res, params){570 return '/post/' + params.id + '/comments';571 app.redirect('comments', function(req, res){572 return '/post/' + req.params.id + '/comments';573 });574575So now we may do the following, and the redirect will dynamically adjust to576the context of the request. If we called this route with _GET /post/12_ our
30 unmodified lines
607608### app.dynamicHelpers(obj)609610Registers dynamic view helpers. Dynamic view helpers609are simply functions which accept _req_, _res_, and _params_, and are611are simply functions which accept _req_, _res_, and are612evaluated against the _Server_ instance before a view is rendered. The _return value_ of this function613becomes the local variable it is associated with.614615 app.dynamicHelpers({614 session: function(req, res, params){616 session: function(req, res){617 return req.session;618 }619 });620
41 unmodified lines
modified:docs/migrate.1+5 added-5 removed
163 unmodified lines
164.165.IP "" 0166.167.P168Route parameters are also passed as the third argument:168Route parameters are available via \fBreq\.params\fR:169.170.IP "" 4171.172.nf173174app\.get(\'/user/:id\', function(req, res, params){175 params\.id;174app\.get(\'/user/:id\', function(req, res){175 req\.params\.id;176});177.178.fi179.
14 unmodified lines
194.195.IP "" 0196.197.P198Now Express has access to Connect\'s \fInext()\fR function, which is passed as the fourth and final argument\. Calling \fInext()\fR will pass control to the next \fImatching route\fR, or continue down the stack of Connect middleware\.198Now Express has access to Connect\'s \fInext()\fR function, which is passed as the third and final argument\. Calling \fInext()\fR will pass control to the next \fImatching route\fR, or continue down the stack of Connect middleware\.199.200.IP "" 4201.202.nf203204app\.get(\'/user/:id?\', function(req, res, params, next){204app\.get(\'/user/:id?\', function(req, res, next){205 next();206});207208app\.get(\'/user\', function(){
139 unmodified lines
modified:docs/migrate.html+5 added-5 removed
296 unmodified lines
297 req.param('id');298});299</code></pre>300301<p>Route parameters are also passed as the third argument:</p>301<p>Route parameters are available via <code>req.params</code>:</p>302303<pre><code>app.get('/user/:id', function(req, res, params){304 params.id;303<pre><code>app.get('/user/:id', function(req, res){304 req.params.id;305});306</code></pre>307308<h3 id="Passing-Route-Control">Passing Route Control</h3>
7 unmodified lines
316});317</code></pre>318319<p>Now Express has access to Connect's <em>next()</em> function,320which is passed as the fourth and final argument. Calling <em>next()</em> will320which is passed as the third and final argument. Calling <em>next()</em> will321pass control to the next <em>matching route</em>, or continue down the stack322of Connect middleware.</p>323324<pre><code>app.get('/user/:id?', function(req, res, params, next){324<pre><code>app.get('/user/:id?', function(req, res, next){325 next();326});327328app.get('/user', function(){
83 unmodified lines
modified:docs/migrate.md+5 added-5 removed