Skip to content
Myr

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

4 files+13 added−3 removed

modified:docs/api.html+1 added-1 removed
1118 unmodified lines
1119 }11201121 <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 lines
modified:docs/guide.1+3 added-1 removed
66 unmodified lines
67.SS "Configuration"68Express 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.P71In 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\.71In 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.nf7677app\.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});8384app\.configure(\'development\', function(){85 app\.use(connect\.errorHandler({ dumpExceptions: true, showStack: true }));
1047 unmodified lines
modified:docs/guide.html+5 added-1 removed
268 unmodified lines
269<em>configure()</em> is called without an environment name it will be run in <em>every</em> environment270prior to the environment specific callback.</p>271272<p>In the example below we only <em>dumpExceptions</em>, and respond with exception stack traces273in <em>development</em> mode, however for both environments we utilize <em>methodOverride</em> and <em>bodyDecoder</em>.</p>273in <em>development</em> mode, however for both environments we utilize <em>methodOverride</em> and <em>bodyDecoder</em>.274Note the use of <em>app.router</em>, which can (optionally) be used to mount the application routes,275otherwise the first call to <em>app.{get,put,del,post}()</em> will mount the routes.</p>276277<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});283284app.configure('development', function(){285 app.use(connect.errorHandler({ dumpExceptions: true, showStack: true }));
689 unmodified lines
modified:docs/guide.md+4 added
37 unmodified lines
38prior to the environment specific callback.3940In the example below we only _dumpExceptions_, and respond with exception stack traces41in _development_ mode, however for both environments we utilize _methodOverride_ and _bodyDecoder_.42Note the use of _app.router_, which can (optionally) be used to mount the application routes,43otherwise the first call to _app.{get,put,del,post}()_ will mount the routes.4445 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