Skip to content
Myr

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 4c95031 · Browse files · 6 files+26 added−30 removed
This commit

State

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

Diff stats

6 files+26 added−30 removed

  • other:+26 added−30 removed

6 files+26 added−30 removed

modified:docs/guide.1+7 added-11 removed
1.\" generated with Ronn/v0.7.32.\" http://github.com/rtomayko/ronn/tree/0.7.33.4.TH "GUIDE" "" "December 2010" "" ""4.TH "GUIDE" "" "March 2011" "" ""5.6.SH "NAME"7\fBguide\fR8.
32 unmodified lines
4142var app = require(\'express\')\.createServer();4344app\.get(\'/\', function(req, res){45 res\.send(\'hello world\');45 res\.send(\'hello world\');46});4748app\.listen(3000);49.
14 unmodified lines
64app\.configure(function(){65 app\.use(express\.methodOverride());66 app\.use(express\.bodyDecoder());67 app\.use(app\.router);68 app\.use(express\.staticProvider(__dirname + \'/public\'));68});6970app\.configure(\'development\', function(){71 app\.use(express\.staticProvider(__dirname + \'/public\'));72 app\.use(express\.errorHandler({ dumpExceptions: true, showStack: true }));73});7475app\.configure(\'production\', function(){76 var oneYear = 31557600000;77 app\.use(express\.staticProvider({ root: __dirname + \'/public\', maxAge: oneYear }));78 app\.use(express\.errorHandler());79});80.81.fi
56 unmodified lines
138.139.IP "\(bu" 4140\fIview options\fR An object specifying global view options141.140.IP "\(bu" 4141\fIstream threshold\fR Bytesize indicating when a file should be streamed for \fIres\.sendfile()\fR using \fIfs\.ReadStream()\fR and \fIsys\.pump()\fR\.142.142.IP "" 0143.144.SS "Routing"145Express 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\.
1065 unmodified lines
1211.fi1212.1213.IP "" 01214.1216.SS "req\.param(name)"1217Return the value of param \fIname\fR when present\.1215.SS "req\.param(name[, default])"1216Return the value of param \fIname\fR when present or \fIdefault\fR\.1217.1218.IP "\(bu" 41219Checks route placeholders (\fIreq\.params\fR), ex: /user/:id1220.
139 unmodified lines
1360.fi1361.1362.IP "" 01363.1365.P1366When the filesize exceeds the \fIstream threshold\fR (defaulting to 32k), the file will be streamed using \fIfs\.ReadStream\fR and \fIsys\.pump()\fR\.1367.1364.SS "res\.download(file[, filename])"1365Transfer the given \fIfile\fR as an attachment with optional alternative \fIfilename\fR\.1366.1367.IP "" 4
604 unmodified lines
modified:docs/guide.html+7 added-8 removed
197 unmodified lines
198<li><a href="#" class="toggle">+</a> <a class="section-title" href="#">Request</a><ul class="section" id="section-Request">199<li><a href="#req-header-key-defaultValue-">header()</a></li>200<li><a href="#req-accepts-type-">accepts()</a></li>201<li><a href="#req-is-type-">is()</a></li>202<li><a href="#req-param-name-">param()</a></li>202<li><a href="#req-param-name-default-">param()</a></li>203<li><a href="#req-flash-type-msg-">flash()</a></li>204<li><a href="#req-isXMLHttpRequest">isXMLHttpRequest</a></li>205</ul></li>206<li><a href="#" class="toggle">+</a> <a class="section-title" href="#">Response</a><ul class="section" id="section-Response">
60 unmodified lines
267268<pre><code>var app = require('express').createServer();269270app.get('/', function(req, res){271 res.send('hello world');271 res.send('hello world');272});273274app.listen(3000);275</code></pre>
13 unmodified lines
289<pre><code>app.configure(function(){290 app.use(express.methodOverride());291 app.use(express.bodyDecoder());292 app.use(app.router);293 app.use(express.staticProvider(__dirname + '/public'));293});294295app.configure('development', function(){296 app.use(express.staticProvider(__dirname + '/public'));297 app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));298});299300app.configure('production', function(){301 var oneYear = 31557600000;302 app.use(express.staticProvider({ root: __dirname + '/public', maxAge: oneYear }));303 app.use(express.errorHandler());304});305</code></pre>306
28 unmodified lines
335<li><em>home</em> Application base path used for <em>res.redirect()</em> and transparently handling mounted apps.</li>336<li><em>views</em> Root views directory defaulting to <strong>CWD/views</strong></li>337<li><em>view engine</em> Default view engine name for views rendered without extensions</li>338<li><em>view options</em> An object specifying global view options</li>337<li><em>stream threshold</em> Bytesize indicating when a file should be streamed for <em>res.sendfile()</em> using <em>fs.ReadStream()</em> and <em>sys.pump()</em>.</li>339</ul>340341342<h3 id="Routing">Routing</h3>
661 unmodified lines
10041005<pre><code>req.is('*/json');1006</code></pre>10071007<h3 id="req-param-name-">req.param(name)</h3>1008<h3 id="req-param-name-default-">req.param(name[, default])</h3>10091009<p>Return the value of param <em>name</em> when present.</p>1010<p>Return the value of param <em>name</em> when present or <em>default</em>.</p>10111012<ul>1013<li>Checks route placeholders (<em>req.params</em>), ex: /user/:id</li>1014<li>Checks query string params (<em>req.query</em>), ex: ?id=12</li>
85 unmodified lines
1100 }1101});1102</code></pre>11031103<p>When the filesize exceeds the <em>stream threshold</em> (defaulting to 32k), the file will be streamed using <em>fs.ReadStream</em> and <em>sys.pump()</em>.</p>11041104<h3 id="res-download-file-filename-">res.download(file[, filename])</h3>11051106<p>Transfer the given <em>file</em> as an attachment with optional alternative <em>filename</em>.</p>1107
380 unmodified lines
modified:docs/guide.md+6 added-6 removed
14 unmodified lines
15follows the same idiom by providing _express.createServer()_ as shown below. This means16that you can utilize Express server's transparently with other libraries.1718 var app = require('express').createServer();19 20 app.get('/', function(req, res){21 res.send('hello world');22 });23 24 app.listen(3000);19 20 app.get('/', function(req, res){21 res.send('hello world');22 });23 24 app.listen(3000);2526### Configuration2728Express supports arbitrary environments, such as _production_ and _development_. Developers
1080 unmodified lines
modified:docs/index.1+4 added-4 removed
1.\" generated with Ronn/v0.7.32.\" http://github.com/rtomayko/ronn/tree/0.7.33.4.TH "INDEX" "" "December 2010" "" ""4.TH "INDEX" "" "March 2011" "" ""5.6.SH "NAME"7\fBindex\fR8.
30 unmodified lines
39.IP "\(bu" 440Content negotiation41.42.IP "\(bu" 443Application mounting44.45.IP "\(bu" 446Focus on high performance47.48.IP "\(bu" 449View rendering and partials support
40 unmodified lines
90.IP "\(bu" 491Follow tjholowaychuk \fIhttp://twitter\.com/tjholowaychuk\fR on twitter for updates92.93.IP "\(bu" 491Annotated source documentation \fIapi\.html\fR92.93.IP "\(bu" 494View the Connect \fIhttp://github\.com/senchalabs/connect\fR repo for middleware usage95.96.IP "\(bu" 497View the Connect Wiki \fIhttp://wiki\.github\.com/senchalabs/connect/\fR for contrib middleware
12 unmodified lines
modified:docs/index.html+1 added-1 removed
210 unmodified lines
211<li>Redirection helpers</li>212<li>Dynamic view helpers</li>213<li>Application level view options</li>214<li>Content negotiation</li>215<li>Application mounting</li>216<li>Focus on high performance</li>217<li>View rendering and partials support</li>218<li>Environment based configuration</li>219<li>Session based flash notifications</li>
19 unmodified lines
239240<ul>241<li><a href="http://groups.google.com/group/express-js">Google Group</a> for discussion</li>242<li>Follow <a href="http://twitter.com/tjholowaychuk">tjholowaychuk</a> on twitter for updates</li>242<li>Annotated source <a href="api.html">documentation</a></li>243<li>View the <a href="http://github.com/senchalabs/connect">Connect</a> repo for middleware usage</li>244<li>View the <a href="http://wiki.github.com/senchalabs/connect/">Connect Wiki</a> for contrib middleware</li>245<li>View the <a href="http://github.com/visionmedia/express/tree/master/examples/">examples</a></li>246<li>View the <a href="http://github.com/visionmedia/express">source</a></li>
9 unmodified lines
modified:docs/index.md+1 added