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 5fcf971 · Browse files · 10 files·+235 added−54 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+235 added−54 removed
- other:+235 added−54 removed
Provenance
- Commit
de81ee7- Tree
e0e2ab4- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
5fcf971
10 files changed+235 added−54 removed
modified:docs/layout/head.html+1 added
122 unmodified linesExpand all12312412512612712812913013148 unmodified lines122 unmodified linesExpand all background: rgba(0,0,0,0.2); border-right: 1px solid rgba(255,255,255,0.05); } #toc li { padding: 1px 0; list-style: none; } #toc li a { font-size: 11px;48 unmodified linesmodified:docs/contrib.html+1 added
122 unmodified lines123 background: rgba(0,0,0,0.2);124 border-right: 1px solid rgba(255,255,255,0.05);125 }126 #toc li {127+ padding: 1px 0;128 list-style: none;129 }130 #toc li a {131 font-size: 11px;89 unmodified linesmodified:docs/executable.html+1 added
122 unmodified lines123 background: rgba(0,0,0,0.2);124 border-right: 1px solid rgba(255,255,255,0.05);125 }126 #toc li {127+ padding: 1px 0;128 list-style: none;129 }130 #toc li a {131 font-size: 11px;71 unmodified linesmodified:docs/guide.1+93 added-13 removed
109 unmodified lines110 .fi111 .112 .IP "" 0113 .114+.P115+To alter the environment we can set the \fICONNECT_ENV\fR environment variable, or more specifically \fIEXPRESS_ENV\fR, for example:116+.117+.IP "" 4118+.119+.nf120+121+$ EXPRESS_ENV=production node app\.js122+.123+.fi124+.125+.IP "" 0126+.127 .SS "Settings"128 Express supports the following settings out of the box:129 .130 .IP "\(bu" 4131+\fIenv\fR Application environment set internally, use \fIapp\.set(\'env\')\fR to utilize132+.133+.IP "\(bu" 4134 \fIhome\fR Application base path used with \fIres\.redirect()\fR135 .136 .IP "\(bu" 4137 \fIviews\fR Root views directory defaulting to \fBCWD/views\fR127 unmodified lines265 .fi266 .267 .IP "" 0268 .253-.SS "Request#header(key[, defaultValue])"269+.SS "req\.header(key[, defaultValue])"270 Get the case\-insensitive request header \fIkey\fR, with optional \fIdefaultValue\fR:271 .272 .IP "" 4273 .6 unmodified lines280 .fi281 .282 .IP "" 0283 .268-.SS "Request#accepts(type)"284+.SS "req\.accepts(type)"285 Check if the \fIAccept\fR header is present, and includes the given \fItype\fR\.286 .287 .P288 When the \fIAccept\fR header is not present \fItrue\fR is returned\. Otherwise the given \fItype\fR is matched by an exact match, and then subtypes\. You may pass the subtype such as \"html\" which is then converted internally to \"text/html\" using the mime lookup table\.20 unmodified lines309 .fi310 .311 .IP "" 0312 .297-.SS "Request#param(name)"313+.SS "req\.param(name)"314 Return the value of param \fIname\fR when present\.315 .316 .IP "\(bu" 4317 Checks route placeholders, ex: /user/:id8 unmodified lines326 .327 .P328 To utilize urlencoded request bodies, \fIreq\.body\fR should be an object\. This can be done by using the \fIconnect\.bodyDecoder\fR middleware\.329 .314-.SS "Request#flash(type[, msg])"330+.SS "req\.flash(type[, msg])"331 Queue flash \fImsg\fR of the given \fItype\fR\.332 .333 .IP "" 4334 .16 unmodified lines351 .fi352 .353 .IP "" 0354 .339-.SS "Request#isXMLHttpRequest"355+.SS "req\.isXMLHttpRequest"356 Also aliased as \fIreq\.xhr\fR, this getter checks the \fIX\-Requested\-With\fR header to see if it was issued by an \fIXMLHttpRequest\fR:357 .358 .IP "" 4359 .5 unmodified lines365 .fi366 .367 .IP "" 0368 .353-.SS "Response#header(key[, val])"369+.SS "res\.header(key[, val])"370 Get or set the response header \fIkey\fR\.371 .372 .IP "" 4373 .11 unmodified lines385 .fi386 .387 .IP "" 0388 .373-.SS "Response#contentType(type)"389+.SS "res\.contentType(type)"390 Sets the \fIContent\-Type\fR response header to the given \fItype\fR\.391 .392 .IP "" 4393 .6 unmodified lines400 .fi401 .402 .IP "" 0403 .388-.SS "Response#attachment([filename])"404+.SS "res\.attachment([filename])"405 Sets the \fIContent\-Disposition\fR response header to \"attachment\", with optional \fIfilename\fR\.406 .407 .IP "" 4408 .4 unmodified lines413 .fi414 .415 .IP "" 0416 .401-.SS "Response#sendfile(path)"417+.SS "res\.sendfile(path)"418 Used by \fBres\.download()\fR to transfer an arbitrary file\.419 .420 .IP "" 4421 .7 unmodified lines429 .430 .P431 \fBNOTE\fR: this is \fInot\fR a replacement for Connect\'s \fIstaticProvider\fR middleware, nor does it perform any security checks, use with caution when using in a dynamic manor\.432 .417-.SS "Response#download(file[, filename])"433+.SS "res\.download(file[, filename])"434 Transfer the given \fIfile\fR as an attachment with optional alternative \fIfilename\fR\.435 .436 .IP "" 4437 .19 unmodified lines457 .fi458 .459 .IP "" 0460 .445-.SS "Response#send(body|status[, headers|status[, status]])"461+.SS "res\.send(body|status[, headers|status[, status]])"462 The \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:463 .464 .IP "" 4465 .12 unmodified lines478 .479 .P480 By default the \fIContent\-Type\fR response header is set, however if explicitly assigned through \fBres\.send()\fR or previously with \fBres\.header()\fR or \fBres\.contentType()\fR it will not be set again\.481 .466-.SS "Response#redirect(url[, status])"482+.SS "res\.redirect(url[, status])"483 Redirect to the given \fIurl\fR with a default response \fIstatus\fR of 302\.484 .485 .IP "" 4486 .11 unmodified lines498 .499 .P500 Express supports \"redirect mapping\", which by default provides \fIhome\fR, and \fIback\fR\. The \fIback\fR map checks the \fIReferrer\fR and \fIReferer\fR headers, while \fIhome\fR utilizes the \"home\" setting and defaults to \"/\"\.501 .502+.SS "app\.set(name[, val])"503+Apply an application level setting \fIname\fR to \fIval\fR, or get the value of \fIname\fR when \fIval\fR is not present:504+.505+.IP "" 4506+.507+.nf508+509+app\.set(\'reload views\', 200);510+app\.set(\'reload views\');511+// => 200512+.513+.fi514+.515+.IP "" 0516+.517+.SS "app\.enable(name)"518+Enable the given setting \fIname\fR:519+.520+.IP "" 4521+.522+.nf523+524+app\.enable(\'some arbitrary setting\');525+app\.set(\'some arbitrary setting\');526+// => true527+.528+.fi529+.530+.IP "" 0531+.532+.SS "app\.disable(name)"533+Disable the given setting \fIname\fR:534+.535+.IP "" 4536+.537+.nf538+539+app\.disable(\'some setting\');540+app\.set(\'some setting\');541+// => false542+.543+.fi544+.545+.IP "" 0546+.547+.SS "app\.configure(env|function[, function])"548+Define a callback function for the given \fIenv\fR (or all environments) with callback \fIfunction\fR:549+.550+.IP "" 4551+.552+.nf553+554+app\.configure(function(){555+ // executed for each env556+});557+558+app\.configure(\'development\', function(){559+ // executed for \'development\' only560+});561+.562+.fi563+.564+.IP "" 0565+.486-.SS "Server#redirect(name, val)"566+.SS "app\.redirect(name, val)"567 For use with \fBres\.redirect()\fR we can map redirects at the application level as shown below:568 .569 .IP "" 4570 .44 unmodified linesmodified:docs/guide.html+79 added-26 removed
122 unmodified lines123 background: rgba(0,0,0,0.2);124 border-right: 1px solid rgba(255,255,255,0.05);125 }126 #toc li {127+ padding: 1px 0;128 list-style: none;129 }130 #toc li a {131 font-size: 11px;40 unmodified lines172 <li><a href="#Settings">Settings</a></li>173 <li><a href="#Routing">Routing</a></li>174 <li><a href="#Passing-Route-Control">Passing Route Control</a></li>175 <li><a href="#Middleware">Middleware</a></li>175-<li><a href="#Request-header-key-defaultValue-">Request#header</a></li>176-<li><a href="#Request-accepts-type-">Request#accepts</a></li>177-<li><a href="#Request-param-name-">Request#param</a></li>178-<li><a href="#Request-flash-type-msg-">Request#flash</a></li>179-<li><a href="#Request-isXMLHttpRequest">Request#isXMLHttpRequest</a></li>180-<li><a href="#Response-header-key-val-">Response#header</a></li>181-<li><a href="#Response-contentType-type-">Response#contentType</a></li>182-<li><a href="#Response-attachment-filename-">Response#attachment</a></li>183-<li><a href="#Response-sendfile-path-">Response#sendfile</a></li>184-<li><a href="#Response-download-file-filename-">Response#download</a></li>185-<li><a href="#Response-send-body-status-headers-status-status-">Response#send</a></li>186-<li><a href="#Response-redirect-url-status-">Response#redirect</a></li>187-<li><a href="#Server-redirect-name-val-">Server#redirect</a></li>176+<li><a href="#req-header-key-defaultValue-">req.header()</a></li>177+<li><a href="#req-accepts-type-">req.accepts()</a></li>178+<li><a href="#req-param-name-">req.param()</a></li>179+<li><a href="#req-flash-type-msg-">req.flash()</a></li>180+<li><a href="#req-isXMLHttpRequest">req.isXMLHttpRequest</a></li>181+<li><a href="#res-header-key-val-">res.header()</a></li>182+<li><a href="#res-contentType-type-">res.contentType()</a></li>183+<li><a href="#res-attachment-filename-">res.attachment()</a></li>184+<li><a href="#res-sendfile-path-">res.sendfile()</a></li>185+<li><a href="#res-download-file-filename-">res.download()</a></li>186+<li><a href="#res-send-body-status-headers-status-status-">res.send()</a></li>187+<li><a href="#res-redirect-url-status-">res.redirect()</a></li>188+<li><a href="#app-set-name-val-">app.set()</a></li>189+<li><a href="#app-enable-name-">app.enable()</a></li>190+<li><a href="#app-disable-name-">app.disable()</a></li>191+<li><a href="#app-configure-env-function-function-">app.configure()</a></li>192+<li><a href="#app-redirect-name-val-">app.redirect()</a></li>193 </ul>194 <a href='http://github.com/visionmedia/express' id='logo'>Express</a> 195 <p id="tagline">196 High performance, high class web development for76 unmodified lines273 // same as app.set('some feature', false);274 });275 </code></pre>276 277+<p>To alter the environment we can set the <em>CONNECT_ENV</em> environment variable,278+or more specifically <em>EXPRESS_ENV</em>, for example:</p>279+280+<pre><code>$ EXPRESS_ENV=production node app.js281+</code></pre>282+283 <h3 id="Settings">Settings</h3>284 285 <p>Express supports the following settings out of the box:</p>286 287 <ul>288+<li><em>env</em> Application environment set internally, use <em>app.set('env')</em> to utilize</li>289 <li><em>home</em> Application base path used with <em>res.redirect()</em></li>290 <li><em>views</em> Root views directory defaulting to <strong>CWD/views</strong></li>291 <li><em>view engine</em> Default view engine name for views rendered without extensions</li>292 <li><em>reload views</em> Reloads altered views, by default watches for <em>mtime</em> changes with87 unmodified lines380 connect.bodyDecoder()381 );382 </code></pre>383 372-<h3 id="Request-header-key-defaultValue-">Request#header(key[, defaultValue])</h3>384+<h3 id="req-header-key-defaultValue-">req.header(key[, defaultValue])</h3>385 386 <p>Get the case-insensitive request header <em>key</em>, with optional <em>defaultValue</em>:</p>387 388 <pre><code>req.header('Host');389 req.header('host');390 req.header('Accept', '*/*');391 </code></pre>392 381-<h3 id="Request-accepts-type-">Request#accepts(type)</h3>393+<h3 id="req-accepts-type-">req.accepts(type)</h3>394 395 <p>Check if the <em>Accept</em> header is present, and includes the given <em>type</em>.</p>396 397 <p>When the <em>Accept</em> header is not present <em>true</em> is returned. Otherwise16 unmodified lines414 req.accepts('png');415 // => false416 </code></pre>417 406-<h3 id="Request-param-name-">Request#param(name)</h3>418+<h3 id="req-param-name-">req.param(name)</h3>419 420 <p>Return the value of param <em>name</em> when present.</p>421 422 <ul>6 unmodified lines429 <p>To utilize urlencoded request bodies, <em>req.body</em>430 should be an object. This can be done by using431 the <em>connect.bodyDecoder</em> middleware.</p>432 421-<h3 id="Request-flash-type-msg-">Request#flash(type[, msg])</h3>433+<h3 id="req-flash-type-msg-">req.flash(type[, msg])</h3>434 435 <p>Queue flash <em>msg</em> of the given <em>type</em>.</p>436 437 <pre><code>req.flash('info', 'email sent');10 unmodified lines448 req.flash();449 // => { error: ['email delivery failed'], info: [] }450 </code></pre>451 440-<h3 id="Request-isXMLHttpRequest">Request#isXMLHttpRequest</h3>452+<h3 id="req-isXMLHttpRequest">req.isXMLHttpRequest</h3>453 454 <p>Also aliased as <em>req.xhr</em>, this getter checks the <em>X-Requested-With</em> header455 to see if it was issued by an <em>XMLHttpRequest</em>:</p>456 457 <pre><code>req.xhr458 req.isXMLHttpRequest459 </code></pre>460 449-<h3 id="Response-header-key-val-">Response#header(key[, val])</h3>461+<h3 id="res-header-key-val-">res.header(key[, val])</h3>462 463 <p>Get or set the response header <em>key</em>.</p>464 465 <pre><code>res.header('Content-Length');5 unmodified lines471 res.header('Content-Length');472 // => 123473 </code></pre>474 463-<h3 id="Response-contentType-type-">Response#contentType(type)</h3>475+<h3 id="res-contentType-type-">res.contentType(type)</h3>476 477 <p>Sets the <em>Content-Type</em> response header to the given <em>type</em>.</p>478 479 <pre><code> var filename = 'path/to/image.png';480 res.contentType(filename);481 // res.headers['Content-Type'] is now "image/png"482 </code></pre>483 472-<h3 id="Response-attachment-filename-">Response#attachment([filename])</h3>484+<h3 id="res-attachment-filename-">res.attachment([filename])</h3>485 486 <p>Sets the <em>Content-Disposition</em> response header to "attachment", with optional <em>filename</em>.</p>487 488 <pre><code> res.attachment('path/to/my/image.png');489 </code></pre>490 479-<h3 id="Response-sendfile-path-">Response#sendfile(path)</h3>491+<h3 id="res-sendfile-path-">res.sendfile(path)</h3>492 493 <p>Used by <code>res.download()</code> to transfer an arbitrary file.</p>494 495 <pre><code>res.sendfile('path/to/my.file');1 unmodified line497 498 <p><strong>NOTE</strong>: this is <em>not</em> a replacement for Connect's <em>staticProvider</em> middleware,499 nor does it perform any security checks, use with caution when using in a dynamic manor.</p>500 489-<h3 id="Response-download-file-filename-">Response#download(file[, filename])</h3>501+<h3 id="res-download-file-filename-">res.download(file[, filename])</h3>502 503 <p>Transfer the given <em>file</em> as an attachment with optional alternative <em>filename</em>.</p>504 505 <pre><code>res.download('path/to/image.png');5 unmodified lines511 <pre><code>res.attachment(file);512 res.sendfile(file);513 </code></pre>514 503-<h3 id="Response-send-body-status-headers-status-status-">Response#send(body|status[, headers|status[, status]])</h3>515+<h3 id="res-send-body-status-headers-status-status-">res.send(body|status[, headers|status[, status]])</h3>516 517 <p>The <code>res.send()</code> method is a high level response utility allowing you to pass518 objects to respond with json, strings for html, arbitrary _Buffer_s or numbers for status519 code based responses. The following are all valid uses:</p>9 unmodified lines529 <p>By default the <em>Content-Type</em> response header is set, however if explicitly530 assigned through <code>res.send()</code> or previously with <code>res.header()</code> or <code>res.contentType()</code>531 it will not be set again.</p>532 521-<h3 id="Response-redirect-url-status-">Response#redirect(url[, status])</h3>533+<h3 id="res-redirect-url-status-">res.redirect(url[, status])</h3>534 535 <p>Redirect to the given <em>url</em> with a default response <em>status</em> of 302.</p>536 537 <pre><code>res.redirect('/', 301);6 unmodified lines544 <p>Express supports "redirect mapping", which by default provides <em>home</em>, and <em>back</em>.545 The <em>back</em> map checks the <em>Referrer</em> and <em>Referer</em> headers, while <em>home</em> utilizes546 the "home" setting and defaults to "/".</p>547 536-<h3 id="Server-redirect-name-val-">Server#redirect(name, val)</h3>548+<h3 id="app-set-name-val-">app.set(name[, val])</h3>549 550+<p>Apply an application level setting <em>name</em> to <em>val</em>, or551+get the value of <em>name</em> when <em>val</em> is not present:</p>552+553+<pre><code>app.set('reload views', 200);554+app.set('reload views');555+// => 200556+</code></pre>557+558+<h3 id="app-enable-name-">app.enable(name)</h3>559+560+<p>Enable the given setting <em>name</em>:</p>561+562+<pre><code>app.enable('some arbitrary setting');563+app.set('some arbitrary setting');564+// => true565+</code></pre>566+567+<h3 id="app-disable-name-">app.disable(name)</h3>568+569+<p>Disable the given setting <em>name</em>:</p>570+571+<pre><code>app.disable('some setting');572+app.set('some setting');573+// => false574+</code></pre>575+576+<h3 id="app-configure-env-function-function-">app.configure(env|function[, function])</h3>577+578+<p>Define a callback function for the given <em>env</em> (or all environments) with callback <em>function</em>:</p>579+580+<pre><code>app.configure(function(){581+ // executed for each env582+});583+584+app.configure('development', function(){585+ // executed for 'development' only586+});587+</code></pre>588+589+<h3 id="app-redirect-name-val-">app.redirect(name, val)</h3>590+591 <p>For use with <code>res.redirect()</code> we can map redirects at the application level as shown below:</p>592 593 <pre><code>app.redirect('google', 'http://google.com');594 </code></pre>26 unmodified linesmodified:docs/guide.md+56 added-13 removed
62 unmodified lines63 app.disable('some feature');64 // same as app.set('some feature', false);65 });66 67+To alter the environment we can set the _CONNECT_ENV_ environment variable,68+or more specifically _EXPRESS_ENV_, for example:69+70+ $ EXPRESS_ENV=production node app.js71+72 ### Settings73 74 Express supports the following settings out of the box:75 76+ * _env_ Application environment set internally, use _app.set('env')_ to utilize77 * _home_ Application base path used with _res.redirect()_78 * _views_ Root views directory defaulting to **CWD/views**79 * _view engine_ Default view engine name for views rendered without extensions80 * _reload views_ Reloads altered views, by default watches for _mtime_ changes with79 unmodified lines160 connect.logger(),161 connect.bodyDecoder()162 );163 158-### Request#header(key[, defaultValue])164+### req.header(key[, defaultValue])165 166 Get the case-insensitive request header _key_, with optional _defaultValue_:167 168 req.header('Host');169 req.header('host');170 req.header('Accept', '*/*');171 166-### Request#accepts(type)172+### req.accepts(type)173 174 Check if the _Accept_ header is present, and includes the given _type_.175 176 When the _Accept_ header is not present _true_ is returned. Otherwise15 unmodified lines192 req.accepts('image/png');193 req.accepts('png');194 // => false195 190-### Request#param(name)196+### req.param(name)197 198 Return the value of param _name_ when present.199 200 - Checks route placeholders, ex: /user/:id3 unmodified lines204 To utilize urlencoded request bodies, _req.body_205 should be an object. This can be done by using206 the _connect.bodyDecoder_ middleware.207 202-### Request#flash(type[, msg])208+### req.flash(type[, msg])209 210 Queue flash _msg_ of the given _type_.211 212 req.flash('info', 'email sent');9 unmodified lines222 223 req.flash();224 // => { error: ['email delivery failed'], info: [] }225 220-### Request#isXMLHttpRequest226+### req.isXMLHttpRequest227 228 Also aliased as _req.xhr_, this getter checks the _X-Requested-With_ header229 to see if it was issued by an _XMLHttpRequest_:230 231 req.xhr232 req.isXMLHttpRequest233 228-### Response#header(key[, val])234+### res.header(key[, val])235 236 Get or set the response header _key_.237 238 res.header('Content-Length');4 unmodified lines243 244 res.header('Content-Length');245 // => 123246 241-### Response#contentType(type)247+### res.contentType(type)248 249 Sets the _Content-Type_ response header to the given _type_.250 251 var filename = 'path/to/image.png';252 res.contentType(filename);253 // res.headers['Content-Type'] is now "image/png"254 249-### Response#attachment([filename])255+### res.attachment([filename])256 257 Sets the _Content-Disposition_ response header to "attachment", with optional _filename_.258 259 res.attachment('path/to/my/image.png');260 255-### Response#sendfile(path)261+### res.sendfile(path)262 263 Used by `res.download()` to transfer an arbitrary file. 264 265 res.sendfile('path/to/my.file');266 267 **NOTE**: this is _not_ a replacement for Connect's _staticProvider_ middleware,268 nor does it perform any security checks, use with caution when using in a dynamic manor.269 264-### Response#download(file[, filename])270+### res.download(file[, filename])271 272 Transfer the given _file_ as an attachment with optional alternative _filename_.273 274 res.download('path/to/image.png');3 unmodified lines278 279 res.attachment(file);280 res.sendfile(file);281 276-### Response#send(body|status[, headers|status[, status]])282+### res.send(body|status[, headers|status[, status]])283 284 The `res.send()` method is a high level response utility allowing you to pass285 objects to respond with json, strings for html, arbitrary _Buffer_s or numbers for status286 code based responses. The following are all valid uses:8 unmodified lines295 By default the _Content-Type_ response header is set, however if explicitly296 assigned through `res.send()` or previously with `res.header()` or `res.contentType()`297 it will not be set again.298 293-### Response#redirect(url[, status])299+### res.redirect(url[, status])300 301 Redirect to the given _url_ with a default response _status_ of 302.302 303 res.redirect('/', 301);5 unmodified lines309 Express supports "redirect mapping", which by default provides _home_, and _back_.310 The _back_ map checks the _Referrer_ and _Referer_ headers, while _home_ utilizes311 the "home" setting and defaults to "/".312 307-### Server#redirect(name, val)313+### app.set(name[, val])314 315+Apply an application level setting _name_ to _val_, or316+get the value of _name_ when _val_ is not present:317+318+ app.set('reload views', 200);319+ app.set('reload views');320+ // => 200321+322+### app.enable(name)323+324+Enable the given setting _name_:325+326+ app.enable('some arbitrary setting');327+ app.set('some arbitrary setting');328+ // => true329+330+### app.disable(name)331+332+Disable the given setting _name_:333+334+ app.disable('some setting');335+ app.set('some setting');336+ // => false337+338+### app.configure(env|function[, function])339+340+Define a callback function for the given _env_ (or all environments) with callback _function_:341+342+ app.configure(function(){343+ // executed for each env344+ });345+346+ app.configure('development', function(){347+ // executed for 'development' only348+ });349+350+### app.redirect(name, val)351+352 For use with `res.redirect()` we can map redirects at the application level as shown below:353 354 app.redirect('google', 'http://google.com');355 17 unmodified linesmodified:docs/index.html+1 added
122 unmodified lines123 background: rgba(0,0,0,0.2);124 border-right: 1px solid rgba(255,255,255,0.05);125 }126 #toc li {127+ padding: 1px 0;128 list-style: none;129 }130 #toc li a {131 font-size: 11px;97 unmodified linesmodified:docs/migrate.html+1 added
122 unmodified lines123 background: rgba(0,0,0,0.2);124 border-right: 1px solid rgba(255,255,255,0.05);125 }126 #toc li {127+ padding: 1px 0;128 list-style: none;129 }130 #toc li a {131 font-size: 11px;267 unmodified linesmodified:examples/helloworld/app.js+1 added-1 removed
9 unmodified lines10 app.get('/', function(req, res){11 res.send('Hello World');12 });13 14-app.listen(3000);14+app.listen(3000);modified:support/toc.js+1 added-1 removed
9 unmodified lines10 if (js.indexOf('id="toc"') < 0) {11 headers.forEach(function(header){12 var captures = header.match(/id="(.*?)">(.*?)</),13 id = captures[1],14- title = captures[2].replace(/\(.*?\)/, '');14+ title = captures[2].replace(/\(.*?\)/, '()');15 toc.push('<li><a href="#' + id + '">' + title + '</a></li>');16 });17 toc.push('</ul>');18 js = js.replace('<div id="container">', '<div id="container">' + toc.join('\n'));3 unmodified lines