Skip to content
Myr

More 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 76052b4 · Browse files · 4 files+143 added−60 removed
This commit

State

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

Diff stats

4 files+143 added−60 removed

  • other:+143 added−60 removed

4 files+143 added−60 removed

modified:docs/api.html+64 added-60 removed
316 unmodified lines
317<li><p><strong>param</strong>: <em>String</em> name</p></li>318<li><p><strong>return</strong>: <em>String</em></p></li>319<li><p><strong>api</strong>: <em>public</em></p></li>320</ul>321321���:322</td>323<td class="code">324<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>){325 <span class="comment">// Route params like /user/:id</span>
143 unmodified lines
469 <span class="this">this</span>.<span class="variable">contentType</span>(<span class="string">'.html'</span>);470 }471 <span class="keyword">break</span>;472 <span class="keyword">case</span> <span class="string">'object'</span>:473 <span class="keyword">if</span> (!(<span class="variable">body</span> <span class="variable">instanceof</span> <span class="class">Buffer</span>)) {473 <span class="keyword">if</span> (<span class="variable">body</span> <span class="variable">instanceof</span> <span class="class">Buffer</span>) {474 <span class="keyword">if</span> (!<span class="this">this</span>.<span class="variable">headers</span>[<span class="string">'Content-Type'</span>]) {475 <span class="this">this</span>.<span class="variable">contentType</span>(<span class="string">'.bin'</span>);476 }477 } <span class="keyword">else</span> {478 <span class="keyword">if</span> (!<span class="this">this</span>.<span class="variable">headers</span>[<span class="string">'Content-Type'</span>]) {479 <span class="this">this</span>.<span class="variable">contentType</span>(<span class="string">'.json'</span>);480 }481 <span class="variable">body</span> = <span class="class">JSON</span>.<span class="variable">stringify</span>(<span class="variable">body</span>);482 }
159 unmodified lines
642 <span class="this">this</span>.<span class="variable">end</span>();643};644</code></pre>645</td>642</tr><tr class="filename"><td><h2 id="lib/express/utils.js">utils</h2></td><td>lib/express/utils.js</td></tr><tr class="code">643<td class="docs">644<p>Parse mini markdown implementation.645The following conversions are supported,646primarily for the &ldquo;flash&rdquo; middleware:</p>647648<p> <em>foo</em> or <em>foo</em> become <em>foo</em>649 <strong>foo</strong> or <strong>foo</strong> become <strong>foo</strong>650 <a href="B">A</a> becomes <a href="B">A</a></p>651652<h2></h2>653654<ul>655<li><p><strong>param</strong>: <em>String</em> str</p></li>656<li><p><strong>return</strong>: <em>String</em></p></li>657<li><p><strong>api</strong>: <em>public</em></p></li>658</ul>659 660</td>661<td class="code">662<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){663 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)664 .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'&lt;strong&gt;$2&lt;/strong&gt;'</span>)665 .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'&lt;em&gt;$2&lt;/em&gt;'</span>)666 .<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>);667};</code></pre>668</td>669</tr>670<tr class="code">671<td class="docs">672<p>Escape special characters in the given string of html.</p>673674<h2></h2>675676<ul>677<li><p><strong>param</strong>: <em>String</em> html</p></li>678<li><p><strong>return</strong>: <em>String</em></p></li>679<li><p><strong>api</strong>: <em>public</em></p></li>680</ul>681682</td>683<td class="code">684<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {685 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)686 .<span class="variable">replace</span>(<span class="regexp">/&amp;/g</span>, <span class="string">'&amp;'</span>)687 .<span class="variable">replace</span>(<span class="regexp">/&quot;/g</span>, <span class="string">'&quot;'</span>)688 .<span class="variable">replace</span>(<span class="regexp">/&lt;/g</span>, <span class="string">'&lt;'</span>)689 .<span class="variable">replace</span>(<span class="regexp">/&gt;/g</span>, <span class="string">'&gt;'</span>);690};</code></pre>691</td>646</tr><tr class="filename"><td><h2 id="lib/express/server.js">server</h2></td><td>lib/express/server.js</td></tr><tr class="code">647<td class="docs">648<p>Module dependencies.</p>649</td>
51 unmodified lines
701</td>702</tr>703<tr class="code">704<td class="docs">751<p>Inherit from <code>connect.Server</code>.</p>� `705<p>Inherit from <code>connect.Server</code>.</p>N %706</td>707<td class="code">708<pre><code><span class="variable">sys</span>.<span class="variable">inherits</span>(<span class="class">Server</span>, <span class="variable">connect</span>.<span class="class">Server</span>);</code></pre>709</td>
39 unmodified lines
749<li><p><strong>param</strong>: <em>String</em> env &hellip;</p></li>750<li><p><strong>return</strong>: <em>Server</em> for chaining</p></li>751<li><p><strong>api</strong>: <em>public</em></p></li>752</ul>753;</p>754755<h2>< 756</td>757<td class="code">758<pre><code><span class="class">Server</span>.<span class="variable">prototype</span>.<span class="variable">runConfig</span> = <span class="keyword">function</span>(){759 <span class="keyword">for</span> (<span class="keyword">var</span> <span class="variable">i</span> = <span class="number integer">0</span>, <span class="variable">len</span> = <span class="variable">arguments</span>.<span class="variable">length</span>; <span class="variable">i</span> &<span class="variable">lt</span>; <span class="variable">len</span>; ++<span class="variable">i</span>) {
123 unmodified lines
883<li><p><strong>param</strong>: <em>String</em> setting</p></li>884<li><p><strong>return</strong>: <em>Server</em> for chaining</p></li>885<li><p><strong>api</strong>: <em>public</em></p></li>886</ul>931Q887888</td>889<td class="code">890<pre><code><span class="class">Server</span>.<span class="variable">prototype</span>.<span class="variable">configure</span> = <span class="keyword">function</span>(<span class="variable">env</span>, <span class="variable">fn</span>){891 <span class="keyword">if</span> (<span class="keyword">typeof</span> <span class="variable">env</span> === <span class="string">'function'</span>) <span class="variable">fn</span> = <span class="variable">env</span>, <span class="variable">env</span> = <span class="string">'any'</span>;
11 unmodified lines
903 <span class="keyword">return</span> <span class="variable">arguments</span>.<span class="variable">callee</span>;904})(<span class="string">'get'</span>)(<span class="string">'post'</span>)(<span class="string">'put'</span>)(<span class="string">'del'</span>);905</code></pre>906</td>907</tr><tr class="filename"><td><h2 id="lib/express/utils.js">utils</h2></td><td>lib/express/utils.js</td></tr><tr class="code">908<td class="docs">909<p>Parse mini markdown implementation.910The following conversions are supported,911primarily for the &ldquo;flash&rdquo; middleware:</p>912913<p> <em>foo</em> or <em>foo</em> become <em>foo</em>914 <strong>foo</strong> or <strong>foo</strong> become <strong>foo</strong>915 <a href="B">A</a> becomes <a href="B">A</a></p>916917<h2></h2>918919<ul>920<li><p><strong>param</strong>: <em>String</em> str</p></li>921<li><p><strong>return</strong>: <em>String</em></p></li>922<li><p><strong>api</strong>: <em>public</em></p></li>923</ul>924 925</td>926<td class="code">927<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){928 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)929 .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'&lt;strong&gt;$2&lt;/strong&gt;'</span>)930 .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'&lt;em&gt;$2&lt;/em&gt;'</span>)931 .<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>);932};</code></pre>933</td>934</tr>935<tr class="code">936<td class="docs">937<p>Escape special characters in the given string of html.</p>938939<h2></h2>940941<ul>942<li><p><strong>param</strong>: <em>String</em> html</p></li>943<li><p><strong>return</strong>: <em>String</em></p></li>944<li><p><strong>api</strong>: <em>public</em></p></li>945</ul>946947</td>948<td class="code">949<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {950 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)951 .<span class="variable">replace</span>(<span class="regexp">/&amp;/g</span>, <span class="string">'&amp;'</span>)952 .<span class="variable">replace</span>(<span class="regexp">/&quot;/g</span>, <span class="string">'&quot;'</span>)953 .<span class="variable">replace</span>(<span class="regexp">/&lt;/g</span>, <span class="string">'&lt;'</span>)954 .<span class="variable">replace</span>(<span class="regexp">/&gt;/g</span>, <span class="string">'&gt;'</span>);955};</code></pre>956</td>957</tr><tr class="filename"><td><h2 id="lib/express/view.js">view</h2></td><td>lib/express/view.js</td></tr><tr class="code">958<td class="docs">959<p>Module dependencies.</p>960</td>
40 unmodified lines
10011002<ul>1003<li><strong>api</strong>: <em>public</em></li>1004</ul>999r1000of cal 1005] %1006</td>1007<td class="code">1008<pre><code><span class="variable">exports</span>.<span class="variable">clearCache</span> = <span class="keyword">function</span>(){1009 <span class="variable">viewCache</span> = {};
6 unmodified lines
10161017<ul>1018<li><strong>type</strong>: <em>Object</em></li>1019</ul>1015P1020 1021</td>1022<td class="code">1023<pre><code><span class="keyword">var</span> <span class="variable">helpers</span> = <span class="variable">exports</span>.<span class="variable">helpers</span> = {};</code></pre>1024</td>
25 unmodified lines
1050<li><p><strong>param</strong>: <em>Object | Array</em> options or collection</p></li>1051<li><p><strong>return</strong>: <em>String</em></p></li>1052<li><p><strong>api</strong>: <em>public</em></p></li>1053</ul>1049P1054 %1055</td>1056<td class="code">1057<pre><code><span class="variable">http</span>.<span class="class">ServerResponse</span>.<span class="variable">prototype</span>.<span class="variable">partial</span> = <span class="keyword">function</span>(<span class="variable">view</span>, <span class="variable">options</span>, <span class="variable">ext</span>){1058 <span class="keyword">if</span> (<span class="variable">ext</span> &<span class="variable">amp</span>;&<span class="variable">amp</span>; <span class="variable">view</span>.<span class="variable">indexOf</span>(<span class="string">'.'</span>) &<span class="variable">lt</span>; <span class="number integer">0</span>) {
57 unmodified lines
1116<li><p><strong>param</strong>: <em>Object</em> options</p></li>1117<li><p><strong>param</strong>: <em>Function</em> fn</p></li>1118<li><p><strong>api</strong>: <em>public</em></p></li>1119</ul>1115(.*?)\/[a-z]*)/1116})11201121</td>1122<td class="code">1123<pre><code><span class="variable">http</span>.<span class="class">ServerResponse</span>.<span class="variable">prototype</span>.<span class="variable">render</span> = <span class="keyword">function</span>(<span class="variable">view</span>, <span class="variable">options</span>, <span class="variable">fn</span>){1124 <span class="variable">options</span> = <span class="variable">options</span> || {};
93 unmodified lines
modified:docs/guide.1+35 added
209 unmodified lines
210.fi211.212.IP "" 0213.214.SS "ServerResponse#header(key[, val])"215Get or set the response header \fIkey\fR\.216.217.IP "" 4218.219.nf220221res\.header(\'Content\-Length\');222// => undefined223224res\.header(\'Content\-Length\', 123);225// => 123226227res\.header(\'Content\-Length\');228// => 123229.230.fi231.232.IP "" 0233.234.SS "ServerResponse#contentType(type)"235Sets the \fIContent\-Type\fR response header to the given \fItype\fR\.236.237.IP "" 4238.239.nf240241 var filename = \'path/to/image\.png\';242 res\.contentType(filename);243 // res\.headers[\'Content\-Type\'] is now \"image/png\"244.245.fi246.247.IP "" 0248.249.SS "ServerRequest#send(body|status[, headers|status[, status]])"250The \fBres\.send()\fR method is a high level response utility allowing you to pass objects to respond with json, strings for html, arbitrary _Buffer_s or numbers for status code based responses\. The following are all valid uses:251.252.IP "" 4
86 unmodified lines
modified:docs/guide.html+23 added
312 unmodified lines
313 connect.bodyDecoder()314);315</code></pre>316317<h3 id="ServerResponse-header-key-val-">ServerResponse#header(key[, val])</h3>318319<p>Get or set the response header <em>key</em>.</p>320321<pre><code>res.header('Content-Length');322// =&gt; undefined323324res.header('Content-Length', 123);325// =&gt; 123326327res.header('Content-Length');328// =&gt; 123329</code></pre>330331<h3 id="ServerResponse-contentType-type-">ServerResponse#contentType(type)</h3>332333<p>Sets the <em>Content-Type</em> response header to the given <em>type</em>.</p>334335<pre><code> var filename = 'path/to/image.png';336 res.contentType(filename);337 // res.headers['Content-Type'] is now "image/png"338</code></pre>339340<h3 id="ServerRequest-send-body-status-headers-status-status-">ServerRequest#send(body|status[, headers|status[, status]])</h3>341342<p>The <code>res.send()</code> method is a high level response utility allowing you to pass343objects to respond with json, strings for html, arbitrary _Buffer_s or numbers for status
61 unmodified lines
modified:docs/guide.md+21 added
139 unmodified lines
140 connect.logger(),141 connect.bodyDecoder()142 );143144### ServerResponse#header(key[, val])145146Get or set the response header _key_.147148 res.header('Content-Length');149 // => undefined150151 res.header('Content-Length', 123);152 // => 123153154 res.header('Content-Length');155 // => 123156157### ServerResponse#contentType(type)158159Sets the _Content-Type_ response header to the given _type_.160161 var filename = 'path/to/image.png';162 res.contentType(filename);163 // res.headers['Content-Type'] is now "image/png"164165### ServerRequest#send(body|status[, headers|status[, status]])166167The `res.send()` method is a high level response utility allowing you to pass168objects to respond with json, strings for html, arbitrary _Buffer_s or numbers for status
50 unmodified lines