Started guide
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 2fda5c7 · Browse files · 7 files·+396 added−6 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+396 added−6 removed
- other:+396 added−6 removed
Provenance
- Commit
9e3a0c6- Tree
ed83427- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
2fda5c7
7 files changed+396 added−6 removed
added:docs/guide.1+100 added
1+.\" generated with Ronn/v0.6.62+.\" http://github.com/rtomayko/ronn/3+.4+.TH "GUIDE" "" "July 2010" "" ""5+.6+.SS "Routing"7+Express 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\.8+.9+.IP "" 410+.11+.nf12+13+app\.get(\'/user/:id\', function(req, res, params){14+ res\.send(\'user \' + params\.id);15+});16+.17+.fi18+.19+.IP "" 020+.21+.P22+Alternatively we may want to create, or \fBPOST\fR a user:23+.24+.IP "" 425+.26+.nf27+28+app\.post(\'/user\', function(){29+ // \.\.\. logic30+});31+.32+.fi33+.34+.IP "" 035+.36+.P37+A route is simple a string which is compiled to a \fIRegExp\fR internally\. For example when \fI/user/:id\fR is compiled, a simplified version of the regexp may look similar to:38+.39+.IP "" 440+.41+.nf42+43+\\/user\\/([^\\/]+)\\/?44+.45+.fi46+.47+.IP "" 048+.49+.P50+Literal regular expressions may also be passed for complex uses:51+.52+.IP "" 453+.54+.nf55+56+app\.get(/^\\/foo(bar)?$/, function(){});57+.58+.fi59+.60+.IP "" 061+.62+.P63+Below are some route examples, and the associated paths that they may consume:64+.65+.IP "" 466+.67+.nf68+69+ \"/user/:id\"70+ /user/1271+72+ \"/users/:id?\"73+ /users/574+ /users75+76+ \"/files/*\"77+ /files/jquery\.js78+ /files/javascripts/jquery\.js79+80+ \"/file/*\.*\"81+ /files/jquery\.js82+ /files/javascripts/jquery\.js83+84+ \"/user/:id/:operation?\"85+ /user/186+ /user/1/edit87+88+ \"/products\.:format\"89+ /products\.json90+ /products\.xml91+92+ \"/products\.:format?\"93+ /products\.json94+ /products\.xml95+ /products96+.97+.fi98+.99+.IP "" 0100+added:docs/guide.html+229 added
1+<html>2+ <head>3+ <title>Express - node web framework</title>4+ <style>5+ #header {6+ position: absolute;7+ top: 10px;8+ left: 0;9+ padding: 12px 0;10+ text-indent: 40px;11+ width: 100%;12+ border-top: 1px solid rgba(0,0,0,0.7);13+ border-bottom: 1px solid rgba(0,0,0,0.7);14+ background: rgba(255,255,255,0.1) url(http://www.sencha.com/favicon.ico) no-repeat 15px 50%;15+ text-align: left;16+ color: #fff;17+ }18+ #tagline {19+ margin-left: 75px;20+ margin-bottom: 30px;21+ color: rgba(255,255,255,0.7); }22+ html {23+ background: #1c1c1c url(images/bg.tile.jpg); }24+25+ body {26+ margin: 0;27+ padding-bottom: 30px;28+ font: 14px/1.4 "Helvetica Neue", "Lucida Grande", "Arial";29+ font-size: 14px;30+ line-height: 1.5;31+ -webkit-text-stroke: 1px rgba(0, 0, 0, 0.1);32+ -moz-text-stroke: 1px rgba(0, 0, 0, 0.1);33+ background: url(images/bg.jpg) 50% 0 no-repeat;34+ color: #8b8b8b; }35+36+ * {37+ outline: none; }38+39+ em {40+ color: white; }41+42+ a img {43+ border: none !important; }44+45+ a {46+ font-weight: bold;47+ color: white;48+ -webkit-transition-property: opacity, -webkit-transform, color, background-color, padding, -webkit-box-shadow;49+ -webkit-transition-duration: 0.15s;50+ -webkit-transition-timing-function: ease-out; }51+ a:hover {52+ opacity: 0.8; }53+54+ h1, h2, h3 {55+ margin: 45px 0 0 0;56+ color: white;57+ text-shadow: 1px 2px 2px rgba(0,0,0,0.6); }58+59+ h3 {60+ margin-left: 20px;61+ font-size: 18px; }62+63+ pre {64+ margin: 20px 10px;65+ padding: 25px 20px;66+ background: rgba(0,0,0,0.5);67+ border: 1px solid #323232;68+ -webkit-box-shadow: 1px 2px 2px rgba(0,0,0,0.6);69+ -moz-box-shadow: 1px 2px 2px rgba(0,0,0,0.6);70+ -webkit-border-radius: 5px;71+ -moz-border-radius: 5px; }72+73+ code {74+ font-family: "Helvetica Neue", "Lucida Grande", "Arial"; }75+76+ ul {77+ margin: 15px 0;78+ padding: 0 0 0 35px; }79+ ul li {80+ margin: 0;81+ padding: 2px 0;82+ list-style: square; }83+84+ .sect {85+ margin-left: 40px; }86+87+ #logo {88+ display: block;89+ margin-left: 30%;90+ margin-bottom: 30px;91+ width: 194px;92+ height: 51px;93+ background: url(images/logo.png) 0 0 no-repeat;94+ text-indent: -99999px; }95+ #logo:hover {96+ opacity: 0.7; }97+ #logo:active {98+ opacity: 0.3; }99+100+ #ribbon {101+ position: fixed;102+ top: 0;103+ right: 0;104+ z-index: 2; }105+106+ #wrapper {107+ width: 100%;108+ min-height: 800px;109+ background: url(images/top.png) 0 0 repeat-x; }110+111+ #container {112+ margin: 0 auto;113+ padding-top: 110px;114+ width: 550px; }115+116+ #menu {117+ margin-left: 130px;118+ padding: 0;119+ padding-bottom: 30px; }120+ #menu li {121+ display: inline;122+ list-style: none; }123+ #menu li a {124+ display: block;125+ float: left;126+ margin: 0 2px;127+ padding: 3px 15px;128+ background: rgba(0,0,0,0.2);129+ -webkit-border-radius: 8px;130+ -moz-border-radius: 8px;131+ -webkit-box-shadow: 1px 2px 2px rgba(0,0,0,0.6);132+ -moz-box-shadow: 1px 2px 2px rgba(0,0,0,0.6);133+ -webkit-transition-property: opacity, -webkit-transform, color, background-color, padding, -webkit-box-shadow;134+ -webkit-transition-duration: 0.15s;135+ -webkit-transition-timing-function: ease-out; }136+ #menu li a:hover,137+ #menu li a.active {138+ padding: 3px 20px;139+ background: rgba(0,0,0,0.5); }140+ #menu li a:active {141+ background: rgba(0,0,0,0.1);142+ -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.4);143+ -moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.4); }144+ </style>145+ </head>146+ <body>147+ <a href='http://github.com/visionmedia/express'> 148+ <img alt='Fork me on GitHub' id='ribbon' src='http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png' /> 149+ </a>150+ <div id="header"><strong>Sencha</strong> labs</div>151+ <div id="wrapper">152+ <div id="container">153+ <a href='http://github.com/visionmedia/express' id='logo'>Express</a> 154+ <p id="tagline">155+ High performance, high class web development for156+ <a href="http://nodejs.org">Node.js</a>157+ </p>158+ <ul id="menu">159+ <li><a href="index.html">Home</a></li>160+ <li><a href="guide.html">Guide</a></li>161+ <li><a href="migrate.html">1.x Migration</a></li>162+ </ul>163+<div class='mp'>164+<h3 id="Routing">Routing</h3>165+166+<p>Express utilizes the HTTP verbs to provide a meaningful, expressive routing API.167+For example we may want to render a user's account for the path <em>/user/12</em>, this168+can be done by defining the route below.</p>169+170+<pre><code>app.get('/user/:id', function(req, res, params){171+ res.send('user ' + params.id);172+});173+</code></pre>174+175+<p>Alternatively we may want to create, or <strong>POST</strong> a user:</p>176+177+<pre><code>app.post('/user', function(){178+ // ... logic179+});180+</code></pre>181+182+<p>A route is simple a string which is compiled to a <em>RegExp</em> internally. For example183+when <em>/user/:id</em> is compiled, a simplified version of the regexp may look similar to:</p>184+185+<pre><code>\/user\/([^\/]+)\/?186+</code></pre>187+188+<p>Literal regular expressions may also be passed for complex uses:</p>189+190+<pre><code>app.get(/^\/foo(bar)?$/, function(){});191+</code></pre>192+193+<p>Below are some route examples, and the associated paths that they194+may consume:</p>195+196+<pre><code> "/user/:id"197+ /user/12198+199+ "/users/:id?"200+ /users/5201+ /users202+203+ "/files/*"204+ /files/jquery.js205+ /files/javascripts/jquery.js206+207+ "/file/*.*"208+ /files/jquery.js209+ /files/javascripts/jquery.js210+211+ "/user/:id/:operation?"212+ /user/1213+ /user/1/edit214+215+ "/products.:format"216+ /products.json217+ /products.xml218+219+ "/products.:format?"220+ /products.json221+ /products.xml222+ /products223+</code></pre>224+225+</div>226+ </div>227+ </div>228+ </body>229+</html>added:docs/guide.md+56 added
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
### Routing
Express 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 _/user/12_, thiscan be done by defining the route below.
app.get('/user/:id', function(req, res, params){ res.send('user ' + params.id); });
Alternatively we may want to create, or **POST** a user:
app.post('/user', function(){ // ... logic });
A route is simple a string which is compiled to a _RegExp_ internally. For examplewhen _/user/:id_ is compiled, a simplified version of the regexp may look similar to:
\/user\/([^\/]+)\/?
Literal regular expressions may also be passed for complex uses:
app.get(/^\/foo(bar)?$/, function(){});
Below are some route examples, and the associated paths that theymay consume:
"/user/:id" /user/12
"/users/:id?" /users/5 /users
"/files/*" /files/jquery.js /files/javascripts/jquery.js
"/file/*.*" /files/jquery.js /files/javascripts/jquery.js "/user/:id/:operation?" /user/1 /user/1/edit "/products.:format" /products.json /products.xml
"/products.:format?" /products.json /products.xml /productsmodified:docs/migrate.1+2 added-2 removed
1 unmodified line2 .\" http://github.com/rtomayko/ronn/3 .4 .TH "MIGRATE" "" "July 2010" "" ""5 .6-.SH "Migration Guide"7-Express 1\.x is written to run on\-top of the Connect \fIhttp://extjs\.github\.com/Connect\fR middlware framework, thus the \fIPlugin\fR has been replaced by Connect\'s middleware\.6+.SS "Built On Connect"7+Express 1\.x is written to run on\-top of the Connect \fIhttp://extjs\.github\.com/Connect\fR middlware framework, thus the \fIPlugin\fR has been replaced by Connect\'s middleware\. By abstracting our middleware to Connect we allow additional community frameworks to develop robust, high\-level frameworks using the same technologies as Express\.8 .9 .SS "Creating Applications"10 Previously due to legacy code implemented in the early days of node, Express unfortunately had some globals\. The DSL would previously be accessed as shown below:11 .319 unmodified linesmodified:docs/migrate.html+4 added-2 removed
159 unmodified lines160 <li><a href="guide.html">Guide</a></li>161 <li><a href="migrate.html">1.x Migration</a></li>162 </ul>163 <div class='mp'>164-<h2 id="Migration-Guide">Migration Guide</h2>164+<h3 id="Built-On-Connect">Built On Connect</h3>165 166 <p>Express 1.x is written to run on-top of the <a href="http://extjs.github.com/Connect">Connect</a> middlware167-framework, thus the <em>Plugin</em> has been replaced by Connect's middleware.</p>167+framework, thus the <em>Plugin</em> has been replaced by Connect's middleware. By abstracting our middleware168+to Connect we allow additional community frameworks to develop robust, high-level frameworks using169+the same technologies as Express.</p>170 171 <h3 id="Creating-Applications">Creating Applications</h3>172 173 <p>Previously due to legacy code implemented in the early days of node,194 unmodified linesmodified:docs/migrate.md+4 added-2 removed
1 2-## Migration Guide2+### Built On Connect3 4 Express 1.x is written to run on-top of the [Connect](http://extjs.github.com/Connect) middlware5-framework, thus the _Plugin_ has been replaced by Connect's middleware.5+framework, thus the _Plugin_ has been replaced by Connect's middleware. By abstracting our middleware6+to Connect we allow additional community frameworks to develop robust, high-level frameworks using7+the same technologies as Express.8 9 ### Creating Applications10 11 Previously due to legacy code implemented in the early days of node,168 unmodified linesmodified:Makefile+1 added
2 unmodified lines3 LIB_PREFIX = ~/.node_libraries4 5 DOCS = docs/index.md \6 docs/executable.md \7+ docs/guide.md \8 docs/migrate.md9 10 MANPAGES =$(DOCS:.md=.1)11 HTMLDOCS =$(DOCS:.md=.html)58 unmodified lines