Updated configuration 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 c10a0a0 · Browse files · 4 files·+13 added−3 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+13 added−3 removed
- other:+13 added−3 removed
Provenance
- Commit
f8ccaa3- Tree
6a086e8- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
c10a0a0
4 files changed+13 added−3 removed
modified:docs/api.html+1 added-1 removed
1118 unmodified lines1119 }1120 1121 <span class="comment">// Cache contents</span>1122 <span class="keyword">try</span> {1123- <span class="keyword">var</span> <span class="variable">str</span> = <span class="variable">viewCache</span>[<span class="variable">path</span>] || <span class="variable">cacheViewSync</span>(<span class="variable">path</span>);1123+ <span class="keyword">var</span> <span class="variable">str</span> = (<span class="variable">options</span>.<span class="variable">cache</span> ? <span class="variable">viewCache</span>[<span class="variable">path</span>] : <span class="keyword">null</span>) || <span class="variable">cacheViewSync</span>(<span class="variable">path</span>);1124 } <span class="keyword">catch</span> (<span class="variable">err</span>) {1125 <span class="keyword">return</span> <span class="variable">error</span>(<span class="variable">err</span>);1126 }1127 27 unmodified linesmodified:docs/guide.1+3 added-1 removed
66 unmodified lines67 .SS "Configuration"68 Express supports arbitrary environments, such as \fIproduction\fR and \fIdevelopment\fR\. Developers can use the \fIconfigure()\fR method to setup needs required by the current environment\. When \fIconfigure()\fR is called without an environment name it will be run in \fIevery\fR environment prior to the environment specific callback\.69 .70 .P71-In the example below we only \fIdumpExceptions\fR, and respond with exception stack traces in \fIdevelopment\fR mode, however for both environments we utilize \fImethodOverride\fR and \fIbodyDecoder\fR\.71+In the example below we only \fIdumpExceptions\fR, and respond with exception stack traces in \fIdevelopment\fR mode, however for both environments we utilize \fImethodOverride\fR and \fIbodyDecoder\fR\. Note the use of \fIapp\.router\fR, which can (optionally) be used to mount the application routes, otherwise the first call to \fIapp\.{get,put,del,post}()\fR will mount the routes\.72 .73 .IP "" 474 .75 .nf76 77 app\.configure(function(){78 app\.use(connect\.methodOverride());79 app\.use(connect\.bodyDecoder());80+ app\.use(app\.router);81+ app\.use(connect\.staticProvider(__dirname + \'/public\'));82 });83 84 app\.configure(\'development\', function(){85 app\.use(connect\.errorHandler({ dumpExceptions: true, showStack: true }));1047 unmodified linesmodified:docs/guide.html+5 added-1 removed
268 unmodified lines269 <em>configure()</em> is called without an environment name it will be run in <em>every</em> environment270 prior to the environment specific callback.</p>271 272 <p>In the example below we only <em>dumpExceptions</em>, and respond with exception stack traces273-in <em>development</em> mode, however for both environments we utilize <em>methodOverride</em> and <em>bodyDecoder</em>.</p>273+in <em>development</em> mode, however for both environments we utilize <em>methodOverride</em> and <em>bodyDecoder</em>.274+Note the use of <em>app.router</em>, which can (optionally) be used to mount the application routes,275+otherwise the first call to <em>app.{get,put,del,post}()</em> will mount the routes.</p>276 277 <pre><code>app.configure(function(){278 app.use(connect.methodOverride());279 app.use(connect.bodyDecoder());280+ app.use(app.router);281+ app.use(connect.staticProvider(__dirname + '/public'));282 });283 284 app.configure('development', function(){285 app.use(connect.errorHandler({ dumpExceptions: true, showStack: true }));689 unmodified linesmodified:docs/guide.md+4 added
37 unmodified lines38 prior to the environment specific callback.39 40 In the example below we only _dumpExceptions_, and respond with exception stack traces41 in _development_ mode, however for both environments we utilize _methodOverride_ and _bodyDecoder_.42+Note the use of _app.router_, which can (optionally) be used to mount the application routes,43+otherwise the first call to _app.{get,put,del,post}()_ will mount the routes.44 45 app.configure(function(){46 app.use(connect.methodOverride());47 app.use(connect.bodyDecoder());48+ app.use(app.router);49+ app.use(connect.staticProvider(__dirname + '/public'));50 });51 52 app.configure('development', function(){53 app.use(connect.errorHandler({ dumpExceptions: true, showStack: true }));606 unmodified lines