Skip to content
Myr

Moved config docs up

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 cb04364 · Browse files · 3 files+162 added−158 removed
This commit

State

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

Diff stats

3 files+162 added−158 removed

  • other:+162 added−158 removed

3 files+162 added−158 removed

modified:docs/guide.1+63 added-63 removed
1 unmodified line
2.\" http://github.com/rtomayko/ronn/3.4.TH "GUIDE" "" "July 2010" "" ""5.6.SS "First Application"7The \fIexpress\.Server\fR now inherits from \fIhttp\.Server\fR, however follows the same idiom by providing \fIexpress\.createServer()\fR as shown below:6.SS "Hello World"7The \fIexpress\.Server\fR now inherits from \fIhttp\.Server\fR, however follows the same idiom by providing \fIexpress\.createServer()\fR as shown below\. This means that you can utilize Express server\'s transparently with other libraries\.8.9.IP "" 410.11.nf
9 unmodified lines
21.fi22.23.IP "" 024.25.SS "Configuration"26Express 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\.27.28.P29In 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\.30.31.IP "" 432.33.nf3435app\.configure(function(){36 app\.use(\'/\', connect\.methodOverride());37 app\.use(\'/\', connect\.bodyDecoder());38});3940app\.configure(\'development\', function(){41 app\.use(\'/\', connect\.errorHandler({ dumpExceptions: true, showStack: true }));42});4344app\.configure(\'production\', function(){45 app\.use(\'/\', connect\.errorHandler());46});47.48.fi49.50.IP "" 051.52.P53For internal and arbitrary settings Express provides the \fIset(key[, val])\fR, \fIenable(key)\fR, \fIdisable(key)\fR methods:54.55.IP "" 456.57.nf5859app\.configure(function(){60 app\.set(\'views\', __dirname + \'/views\');61 app\.set(\'views\');62 // => \"\.\.\. views directory \.\.\.\"6364 app\.enable(\'some feature\');65 // same as app\.set(\'some feature\', true);6667 app\.disable(\'some feature\');68 // same as app\.set(\'some feature\', false);69});70.71.fi72.73.IP "" 074.75.SS "Settings"76Express supports the following settings out of the box:77.78.IP "\(bu" 479\fIviews\fR Root views directory defaulting to \fBCWD/views\fR80.81.IP "\(bu" 482\fIview engine\fR Default view engine name for views rendered without extensions83.84.IP "" 085.86.SS "Routing"87Express 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 passed as the \fIthird\fR argument, which here we name \fIparams\fR\.88.89.IP "" 4
114 unmodified lines
204.205.fi206.207.IP "" 0147.148.SS "Configuration"149Express 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\.150.151.P152In 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\.153.154.IP "" 4155.156.nf208158app\.configure(function(){159 app\.use(\'/\', connect\.methodOverride());160 app\.use(\'/\', connect\.bodyDecoder());161});162163app\.configure(\'development\', function(){164 app\.use(\'/\', connect\.errorHandler({ dumpExceptions: true, showStack: true }));165});166167app\.configure(\'production\', function(){168 app\.use(\'/\', connect\.errorHandler());169});170.171.fi172.173.IP "" 0174.175.P176For internal and arbitrary settings Express provides the \fIset(key[, val])\fR, \fIenable(key)\fR, \fIdisable(key)\fR methods:177.178.IP "" 4179.180.nf181182app\.configure(function(){183 app\.set(\'views\', __dirname + \'/views\');184 app\.set(\'views\');185 // => \"\.\.\. views directory \.\.\.\"186187 app\.enable(\'some feature\');188 // same as app\.set(\'some feature\', true);189190 app\.disable(\'some feature\');191 // same as app\.set(\'some feature\', false);192});193.194.fi195.196.IP "" 0197.198.SS "Settings"199Express supports the following settings out of the box:200.201.IP "\(bu" 4202\fIviews\fR Root views directory defaulting to \fBCWD/views\fR203.204.IP "\(bu" 4205\fIview engine\fR Default view engine name for views rendered without extensions206.207.IP "" 0208
modified:docs/guide.html+52 added-51 removed
158 unmodified lines
159 <li><a href="guide.html">Guide</a></li>160 <li><a href="migrate.html">1.x Migration</a></li>161 </ul>162<div class='mp'>163<h3 id="First-Application">First Application</h3>163<h3 id="Hello-World">Hello World</h3>164165<p>The <em>express.Server</em> now inherits from <em>http.Server</em>, however166follows the same idiom by providing <em>express.createServer()</em> as shown below:</p>166follows the same idiom by providing <em>express.createServer()</em> as shown below. This means167that you can utilize Express server's transparently with other libraries.</p>168169<pre><code>var app = require('express').createServer();170171app.get('/', function(req, res){
2 unmodified lines
174175app.listen(3000);176</code></pre>177178<h3 id="Configuration">Configuration</h3>179180<p>Express supports arbitrary environments, such as <em>production</em> and <em>development</em>. Developers181can use the <em>configure()</em> method to setup needs required by the current environment. When182<em>configure()</em> is called without an environment name it will be run in <em>every</em> environment183prior to the environment specific callback.</p>184185<p>In the example below we only <em>dumpExceptions</em>, and respond with exception stack traces186in <em>development</em> mode, however for both environments we utilize <em>methodOverride</em> and <em>bodyDecoder</em>.</p>187188<pre><code>app.configure(function(){189 app.use('/', connect.methodOverride());190 app.use('/', connect.bodyDecoder());191});192193app.configure('development', function(){194 app.use('/', connect.errorHandler({ dumpExceptions: true, showStack: true }));195});196197app.configure('production', function(){198 app.use('/', connect.errorHandler());199});200</code></pre>201202<p>For internal and arbitrary settings Express provides the <em>set(key[, val])</em>, <em>enable(key)</em>, <em>disable(key)</em> methods:</p>203204<pre><code>app.configure(function(){205 app.set('views', __dirname + '/views');206 app.set('views');207 // =&gt; "... views directory ..."208209 app.enable('some feature');210 // same as app.set('some feature', true);211212 app.disable('some feature');213 // same as app.set('some feature', false);214});215</code></pre>216217<h3 id="Settings">Settings</h3>218219<p>Express supports the following settings out of the box:</p>220221<ul>222<li><em>views</em> Root views directory defaulting to <strong>CWD/views</strong></li>223<li><em>view engine</em> Default view engine name for views rendered without extensions</li>224</ul>225226227<h3 id="Routing">Routing</h3>228229<p>Express utilizes the HTTP verbs to provide a meaningful, expressive routing API.230For example we may want to render a user's account for the path <em>/user/12</em>, this
80 unmodified lines
311 connect.bodyDecoder()312);313</code></pre>314265<h3 id="Configuration">Configuration</h3>266267<p>Express supports arbitrary environments, such as <em>production</em> and <em>development</em>. Developers268can use the <em>configure()</em> method to setup needs required by the current environment. When269<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>274275<pre><code>app.configure(function(){276 app.use('/', connect.methodOverride());277 app.use('/', connect.bodyDecoder());278});279280app.configure('development', function(){281 app.use('/', connect.errorHandler({ dumpExceptions: true, showStack: true }));282});283284app.configure('production', function(){285 app.use('/', connect.errorHandler());286});287</code></pre>288289<p>For internal and arbitrary settings Express provides the <em>set(key[, val])</em>, <em>enable(key)</em>, <em>disable(key)</em> methods:</p>290291<pre><code>app.configure(function(){292 app.set('views', __dirname + '/views');293 app.set('views');294 // =&gt; "... views directory ..."295296 app.enable('some feature');297 // same as app.set('some feature', true);298299 app.disable('some feature');300 // same as app.set('some feature', false);301});302</code></pre>303304<h3 id="Settings">Settings</h3>305306<p>Express supports the following settings out of the box:</p>307308<ul>309<li><em>views</em> Root views directory defaulting to <strong>CWD/views</strong></li>310<li><em>view engine</em> Default view engine name for views rendered without extensions</li>311</ul>312313315</div>316 </div>317 </div>318 </body>
1 unmodified line
modified:docs/guide.md+47 added-44 removed