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 aaa5deb · Browse files · 7 files+76 added−78 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+76 added−78 removed

  • other:+76 added−78 removed

7 files+76 added−78 removed

modified:docs/api.html+46 added-62 removed
112 unmodified lines
113<p>Framework version.114 </p>115</td>116<td class="code">117<pre><code><span class="variable">exports</span>.<span class="variable">version</span> = <span class="string">'1.0.0beta2'</span>;</code></pre>117<pre><code><span class="variable">exports</span>.<span class="variable">version</span> = <span class="string">'1.0.0rc'</span>;</code></pre>118</td>119</tr>120<tr class="code">121<td class="docs">
457 unmodified lines
579 <span class="this">this</span>.<span class="variable">end</span>();580};581</code></pre>582</td>583</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">584<td class="docs">585<p>Parse mini markdown implementation.586The following conversions are supported,587primarily for the "flash" middleware:</p>588589<p> <em>foo</em> or <em>foo</em> become &lt;em&gt;foo&lt;/em&gt;590 <strong>foo</strong> or <strong>foo</strong> become &lt;strong&gt;foo&lt;/strong&gt;591 <a href="B">A</a> becomes &lt;a href="B"&gt;A&lt;/a&gt;</p>592593<h2></h2>594595<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>596</td>597<td class="code">598<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){599 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)600 .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'&lt;strong&gt;$2&lt;/strong&gt;'</span>)601 .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'&lt;em&gt;$2&lt;/em&gt;'</span>)602 .<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>);603};</code></pre>604</td>605</tr>606<tr class="code">607<td class="docs">608<p>Escape special characters in the given string of html.</p>609610<h2></h2>611612<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>613</td>614<td class="code">615<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {616 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)617 .<span class="variable">replace</span>(<span class="regexp">/&amp;/g</span>, <span class="string">'&amp;'</span>)618 .<span class="variable">replace</span>(<span class="regexp">/&quot;/g</span>, <span class="string">'&quot;'</span>)619 .<span class="variable">replace</span>(<span class="regexp">/&lt;/g</span>, <span class="string">'&lt;'</span>)620 .<span class="variable">replace</span>(<span class="regexp">/&gt;/g</span>, <span class="string">'&gt;'</span>);621};</code></pre>622</td>583</tr><tr class="filename"><td><h2 id="lib/express/server.js"><a href="#">server</a></h2></td><td>lib/express/server.js</td></tr><tr class="code">584<td class="docs">585<p>Module dependencies.586 </p>
28 unmodified lines
615616 <span class="comment">// Default &quot;home&quot; to / </span>617 <span class="this">this</span>.<span class="variable">set</span>(<span class="string">'home'</span>, <span class="string">'/'</span>);618659 <span class="comment">// Set &quot;env&quot; to {EXPRESS,CONNECT}_ENV</span>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>);619 <span class="comment">// Set &quot;env&quot; to EXPRESS_ENV or connectEnv.name</span>620 <span class="this">this</span>.<span class="variable">set</span>(<span class="string">'env'</span>,621 <span class="variable">process</span>.<span class="variable">env</span>.<span class="class">EXPRESS_ENV</span> ||622 <span class="variable">process</span>.<span class="variable">connectEnv</span>.<span class="variable">name</span>);623624 <span class="comment">// Expose objects to each other</span>625 <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>){626 <span class="variable">req</span>.<span class="variable">query</span> = {};
29 unmodified lines
656</td>657</tr>658<tr class="code">659<td class="docs">698<p>Start listening on the given <code>port</code> / <code>host</code>.</p>699700<h2></h2>701702<ul><li><p><strong>param</strong>: <em>Number</em> port</p></li><li><p><strong>param</strong>: <em>String</em> host</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>703</td>704<td class="code">705<pre><code><span class="class">Server</span>.<span class="variable">prototype</span>.<span class="variable">listen</span> = <span class="keyword">function</span>(<span class="variable">port</span>, <span class="variable">host</span>){706 <span class="comment">// Setup view reloading</span>707 <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">set</span>(<span class="string">'reload views'</span>)) {708 <span class="variable">view</span>.<span class="variable">watcher</span>.<span class="variable">call</span>(<span class="this">this</span>, <span class="this">this</span>.<span class="variable">set</span>(<span class="string">'reload views'</span>));709 }710 <span class="variable">connect</span>.<span class="class">Server</span>.<span class="variable">prototype</span>.<span class="variable">listen</span>.<span class="variable">call</span>(<span class="this">this</span>, <span class="variable">port</span>, <span class="variable">host</span>);711};</code></pre>712</td>713</tr>714<tr class="code">715<td class="docs">660<p>Proxy <code>connect.Server#use()</code> to apply settings to661mounted applications.</p>662663<h2></h2>
194 unmodified lines
858 <span class="keyword">return</span> <span class="variable">arguments</span>.<span class="variable">callee</span>;859})(<span class="string">'get'</span>)(<span class="string">'post'</span>)(<span class="string">'put'</span>)(<span class="string">'del'</span>);860</code></pre>861</td>862</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">863<td class="docs">864<p>Parse mini markdown implementation.865The following conversions are supported,866primarily for the "flash" middleware:</p>867868<p> <em>foo</em> or <em>foo</em> become &lt;em&gt;foo&lt;/em&gt;869 <strong>foo</strong> or <strong>foo</strong> become &lt;strong&gt;foo&lt;/strong&gt;870 <a href="B">A</a> becomes &lt;a href="B"&gt;A&lt;/a&gt;</p>871872<h2></h2>873874<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>875</td>876<td class="code">877<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){878 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)879 .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'&lt;strong&gt;$2&lt;/strong&gt;'</span>)880 .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'&lt;em&gt;$2&lt;/em&gt;'</span>)881 .<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>);882};</code></pre>883</td>884</tr>885<tr class="code">886<td class="docs">887<p>Escape special characters in the given string of html.</p>888889<h2></h2>890891<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>892</td>893<td class="code">894<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {895 <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)896 .<span class="variable">replace</span>(<span class="regexp">/&amp;/g</span>, <span class="string">'&amp;'</span>)897 .<span class="variable">replace</span>(<span class="regexp">/&quot;/g</span>, <span class="string">'&quot;'</span>)898 .<span class="variable">replace</span>(<span class="regexp">/&lt;/g</span>, <span class="string">'&lt;'</span>)899 .<span class="variable">replace</span>(<span class="regexp">/&gt;/g</span>, <span class="string">'&gt;'</span>);900};</code></pre>901</td>902</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">903<td class="docs">904<p>Module dependencies.905 </p>
112 unmodified lines
10181019<p> Most engines accept one or more of the following options,1020 both <em>haml</em> and <em>jade</em> accept all:</p>10211038<ul><li><code>context|scope</code> Template evaluation context (<code>this</code>)</li><li><code>locals</code> Object containing local variables</li><li><code>filename</code> Filename used for the <code>cache</code> option</li><li><code>cache</code> Cache intermediate JavaScript in memory</li><li><code>debug</code> Output debugging information</li></ul>1022<ul><li><code>context|scope</code> Template evaluation context (<code>this</code>)</li><li><code>locals</code> Object containing local variables</li><li><code>debug</code> Output debugging information</li></ul>10231024<h2></h2>10251026<ul><li><p><strong>param</strong>: <em>String</em> view</p></li><li><p><strong>param</strong>: <em>Object</em> options</p></li><li><p><strong>param</strong>: <em>Function</em> fn</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
114 unmodified lines
modified:docs/contrib.1+3 added-1 removed
72 unmodified lines
73.IP "\(bu" 474Indents are \fI4\fR spaces\.75.76.IP "" 07777.78.SS "Documentation"79To contribute documentation edit the markdown files in \fI\./docs\fR, however do \fInot\fR run \fImake docs\fR, as they will be re\-built and published with each release\.
modified:docs/contrib.html+5 added
229 unmodified lines
230<li>Indents are <em>4</em> spaces.</li>231</ul>232233234<h3 id="Documentation">Documentation</h3>235236<p>To contribute documentation edit the markdown files in <em>./docs</em>, however237do <em>not</em> run <em>make docs</em>, as they will be re-built and published with each release.</p>238239</div>240 </div>241 </div>242 </body>
1 unmodified line
modified:docs/guide.1+3 added-9 removed
141 unmodified lines
142.143.IP "\(bu" 4144\fIview engine\fR Default view engine name for views rendered without extensions145.146.IP "\(bu" 4147\fIreload views\fR Reloads altered views, by default watches for \fImtime\fR changes with with a 500 millisecond interval\.148.146.IP "" 0147.148.SS "Routing"149Express 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\.
631 unmodified lines
781.IP "\(bu" 4782\fIlocals\fR Object containing local variables783.784.IP "\(bu" 4788\fIcache\fR Cache intermediate JavaScript in memory (the default in \fIproduction\fR mode)789.790.IP "\(bu" 4785\fIdebug\fR Output debugging information786.787.IP "" 0788.
84 unmodified lines
873.IP "" 4874.875.nf876883app\.set(\'reload views\', 200);884app\.set(\'reload views\');885// => 200877app\.set(\'views\', __dirname + \'/views\');878app\.set(\'views\');879// => \.\.\.path\.\.\.880.881.fi882.883.IP "" 0
243 unmodified lines
modified:docs/guide.html+3 added-6 removed
317 unmodified lines
318<li><em>env</em> Application environment set internally, use <em>app.set('env')</em> on <em>Server#listen()</em></li>319<li><em>home</em> Application base path used for <em>res.redirect()</em> and transparently handling mounted apps.</li>320<li><em>views</em> Root views directory defaulting to <strong>CWD/views</strong></li>321<li><em>view engine</em> Default view engine name for views rendered without extensions</li>322<li><em>reload views</em> Reloads altered views, by default watches for <em>mtime</em> changes with323 with a 500 millisecond interval.</li>322</ul>323324325<h3 id="Routing">Routing</h3>
429 unmodified lines
755756<ul>757<li><em>context|scope</em> Template evaluation context (<em>this</em>)</li>758<li><em>locals</em> Object containing local variables</li>761<li><em>cache</em> Cache intermediate JavaScript in memory (the default in <em>production</em> mode)</li>759<li><em>debug</em> Output debugging information</li>760</ul>761762
49 unmodified lines
812813<p>Apply an application level setting <em>name</em> to <em>val</em>, or814get the value of <em>name</em> when <em>val</em> is not present:</p>815819<pre><code>app.set('reload views', 200);820app.set('reload views');821// =&gt; 200816<pre><code>app.set('views', __dirname + '/views');817app.set('views');818// =&gt; ...path...819</code></pre>820821<h3 id="app-enable-name-">app.enable(name)</h3>822
150 unmodified lines
modified:docs/index.1+12 added
96 unmodified lines
97.98.SH "Apps Using Express"99.100.IP "\(bu" 4101wtfjs \fIhttp://wtfjs\.com/\fR \- JavaScript WTFs :)102.103.IP "\(bu" 4104Node Knockout \fIhttp://nodeknockout\.com/\fR \- node knockout competition site105.106.IP "\(bu" 4107Node News \fIhttp://nodejs\.se/\fR \- node news aggregator108.109.IP "\(bu" 4110Code Shelver \fIhttp://codeshelver\.com/\fR \- GitHub watch list app111.112.IP "\(bu" 4113Clickdummy \fIhttp://clickdummy\.net/\fR \- Fast prototyping for designers114.115.IP "\(bu" 4116E\-Resistible \fIe\-resistible\.co\.uk\fR \- Online takeaway ordering app117.118.IP "" 0119
modified:docs/index.html+4 added
242 unmodified lines
243244<h2 id="Apps-Using-Express">Apps Using Express</h2>245246<ul>247<li><a href="http://wtfjs.com/">wtfjs</a> - JavaScript WTFs :)</li>248<li><a href="http://nodeknockout.com/">Node Knockout</a> - node knockout competition site</li>249<li><a href="http://nodejs.se/">Node News</a> - node news aggregator</li>250<li><a href="http://codeshelver.com/">Code Shelver</a> - GitHub watch list app</li>251<li><a href="http://clickdummy.net/">Clickdummy</a> - Fast prototyping for designers</li>252<li><a href="e-resistible.co.uk">E-Resistible</a> - Online takeaway ordering app</li>253</ul>254255256</div>
4 unmodified lines