Removed backticks from 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 927aae7 · Browse files · 3 files·+39 added−39 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+39 added−39 removed
- other:+39 added−39 removed
Provenance
- Commit
c3f71b3- Tree
df1c353- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
927aae7
3 files changed+39 added−39 removed
modified:docs/migrate.1+11 added-11 removed
2 unmodified lines3 .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 \fBPlugin\fR has been replaced by Connect\'s middleware\.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\.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 .15 unmodified lines27 .28 .IP "" 029 .30 .P31-Now we utilize the CommonJS module system appropriately, and introduce \fBexpress\.createServer()\fR which accepts the same arguments as \fBhttp\.createServer()\fR:31+Now we utilize the CommonJS module system appropriately, and introduce \fIexpress\.createServer()\fR which accepts the same arguments as \fIhttp\.createServer()\fR:32 .33 .IP "" 434 .35 .nf31 unmodified lines67 .68 .IP "" 069 .70 .P71-Which we can now \fBuse()\fR within our app, or pass to the \fBexpress\.createServer()\fR method:71+Which we can now \fIuse()\fR within our app, or pass to the \fIexpress\.createServer()\fR method:72 .73 .IP "" 474 .75 .nf31 unmodified lines107 .P108 For documentation on creating Connect middleware visit Middleware Authoring \fIhttp://extjs\.github\.com/Connect/#Middleware\-Authoring\fR\.109 .110 .SS "Running Applications"111-Previously a global function \fBrun()\fR, was available:111+Previously a global function \fIrun()\fR, was available:112 .113 .IP "" 4114 .115 .nf4 unmodified lines120 .121 .IP "" 0122 .123 .P124-The new \fBexpress\.Server\fR has the same API as \fBhttp\.Server\fR, so we can do things like:124+The new \fIexpress\.Server\fR has the same API as \fIhttp\.Server\fR, so we can do things like:125 .126 .IP "" 4127 .128 .nf5 unmodified lines134 .135 .IP "" 0136 .137 .SS "Route Parameters"138-Previously we could use \fBthis\.param()\fR to attempt fetching a route, query string, or request body parameter:138+Previously we could use \fIthis\.param()\fR to attempt fetching a route, query string, or request body parameter:139 .140 .IP "" 4141 .142 .nf36 unmodified lines179 .180 .IP "" 0181 .182 .P183-Now Express has access to Connect\'s \fBnext()\fR function, which is passed as the fourth and final argument\. Calling \fBnext()\fR will pass control to the next \fImatching route\fR, or continue down the stack of Connect middleware\.183+Now Express has access to Connect\'s \fInext()\fR function, which is passed as the fourth and final argument\. Calling \fInext()\fR will pass control to the next \fImatching route\fR, or continue down the stack of Connect middleware\.184 .185 .IP "" 4186 .187 .nf10 unmodified lines198 .199 .IP "" 0200 .201 .SS "View Rendering"202-View filenames no longer take the form \fINAME\fR\.\fITYPE\fR\.\fIENGINE\fR, the \fIContent\-Type\fR can be set via \fBServerResponse#contentType()\fR or \fBServerResponse#header()\fR\. For example what was previously \fIlayout\.html\.haml\fR, should now be \fIlayout\.haml\fR\.202+View filenames no longer take the form \fINAME\fR\.\fITYPE\fR\.\fIENGINE\fR, the \fIContent\-Type\fR can be set via \fIres\.contentType()\fR or \fIres\.header()\fR\. For example what was previously \fIlayout\.html\.haml\fR, should now be \fIlayout\.haml\fR\.203 .204 .P205 Previously a view render looked something like this:206 .11 unmodified lines218 .219 .IP "" 0220 .221 .P222-We now have \fBServerResponse#render()\fR, however the options passed to haml \fIhttp://github\.com/visionmedia/haml\.js\fR, jade \fIhttp://github\.com/visionmedia/jade\fR, and others remain the same\.222+We now have \fIres\.render()\fR, however the options passed to haml \fIhttp://github\.com/visionmedia/haml\.js\fR, jade \fIhttp://github\.com/visionmedia/jade\fR, and others remain the same\.223 .224 .IP "" 4225 .226 .nf8 unmodified lines235 .236 .IP "" 0237 .238 .P239-Previously rendering of a collection via \fBpartial()\fR would look something like this:239+Previously rendering of a collection via \fIpartial()\fR would look something like this:240 .241 .IP "" 4242 .243 .nf4 unmodified lines248 .249 .IP "" 0250 .251 .P252-Although this worked just fine, it was generally to verbose, the similar but new API looks like this, as \fBpartial()\fR is \fIalways\fR passed as a local variable:252+Although this worked just fine, it was generally to verbose, the similar but new API looks like this, as \fIpartial()\fR is \fIalways\fR passed as a local variable:253 .254 .IP "" 4255 .256 .nf33 unmodified linesmodified:docs/migrate.html+14 added-14 removed
152 unmodified lines153 <div class='mp'>154 <h2 id="Migration-Guide">Migration Guide</h2>155 156 <p>Express 1.x is written to run on-top of the <a href="http://extjs.github.com/Connect">Connect</a> middlware157-framework, thus the <code>Plugin</code> has been replaced by Connect's middleware.</p>157+framework, thus the <em>Plugin</em> has been replaced by Connect's middleware.</p>158 159 <h3 id="Creating-Applications">Creating Applications</h3>160 161 <p>Previously due to legacy code implemented in the early days of node,11 unmodified lines173 });174 </code></pre>175 176 <p>Now we utilize the CommonJS module system appropriately, and177-introduce <code>express.createServer()</code> which accepts the same arguments178-as <code>http.createServer()</code>:</p>177+introduce <em>express.createServer()</em> which accepts the same arguments178+as <em>http.createServer()</em>:</p>179 180 <pre><code>var express = require('express'),181 app = express.createServer();182 18 unmodified lines201 use(MethodOverride);202 use(Cookie);203 </code></pre>204 205-<p>Which we can now <code>use()</code> within our app, or pass to the <code>express.createServer()</code> method:</p>205+<p>Which we can now <em>use()</em> within our app, or pass to the <em>express.createServer()</em> method:</p>206 207 <pre><code>var connect = require('connect');208 209 var app = express.createServer(16 unmodified lines226 <p>For documentation on creating Connect middleware visit <a href="http://extjs.github.com/Connect/#Middleware-Authoring">Middleware Authoring</a>.</p>227 228 <h3 id="Running-Applications">Running Applications</h3>229 230-<p>Previously a global function <code>run()</code>, was available:</p>230+<p>Previously a global function <em>run()</em>, was available:</p>231 232 <pre><code>run();233 </code></pre>234 235-<p>The new <code>express.Server</code> has the same API as <code>http.Server</code>,235+<p>The new <em>express.Server</em> has the same API as <em>http.Server</em>,236 so we can do things like:</p>237 238 <pre><code>app.listen();239 app.listen(3000);240 </code></pre>241 242 <h3 id="Route-Parameters">Route Parameters</h3>243 244-<p>Previously we could use <code>this.param()</code> to attempt244+<p>Previously we could use <em>this.param()</em> to attempt245 fetching a route, query string, or request body parameter:</p>246 247 <pre><code>get('/user/:id', function(){248 this.param('id');17 unmodified lines266 this.pass('/foobar');267 });268 </code></pre>269 270-<p>Now Express has access to Connect's <code>next()</code> function,271-which is passed as the fourth and final argument. Calling <code>next()</code> will270+<p>Now Express has access to Connect's <em>next()</em> function,271+which is passed as the fourth and final argument. Calling <em>next()</em> will272 pass control to the next <em>matching route</em>, or continue down the stack273 of Connect middleware.</p>274 275 <pre><code>app.get('/user/:id?', function(req, res, params, next){7 unmodified lines283 284 <h3 id="View-Rendering">View Rendering</h3>285 286 <p>View filenames no longer take the form <em>Express</em>.<em>TYPE</em>.<em>ENGINE</em>,287-the <em>Content-Type</em> can be set via <code>ServerResponse#contentType()</code> or288-<code>ServerResponse#header()</code>. For example what was previously <em>layout.html.haml</em>,287+the <em>Content-Type</em> can be set via <em>res.contentType()</em> or288+<em>res.header()</em>. For example what was previously <em>layout.html.haml</em>,289 should now be <em>layout.haml</em>.</p>290 291 <p>Previously a view render looked something like this:</p>292 3 unmodified lines296 });297 });298 </code></pre>299 300-<p>We now have <code>ServerResponse#render()</code>, however the options passed to <a href="http://github.com/visionmedia/haml.js">haml</a>, <a href="http://github.com/visionmedia/jade">jade</a>, and others300+<p>We now have <em>res.render()</em>, however the options passed to <a href="http://github.com/visionmedia/haml.js">haml</a>, <a href="http://github.com/visionmedia/jade">jade</a>, and others301 remain the same.</p>302 303 <pre><code>app.get('/', function(req, res){304 res.render('index.haml', {1 unmodified line306 });307 });308 </code></pre>309 310-<p>Previously rendering of a collection via <code>partial()</code> would look something like this:</p>310+<p>Previously rendering of a collection via <em>partial()</em> would look something like this:</p>311 312 <pre><code>this.partial('comment.html.haml', { collection: comments });313 </code></pre>314 315 <p>Although this worked just fine, it was generally to verbose, the similar but new API316-looks like this, as <code>partial()</code> is <em>always</em> passed as a local variable:</p>316+looks like this, as <em>partial()</em> is <em>always</em> passed as a local variable:</p>317 318 <pre><code>partial('comment.haml', { collection: comments });319 </code></pre>320 16 unmodified linesmodified:docs/migrate.md+14 added-14 removed
123455678910 unmodified lines20212223242524252627282916 unmodified lines4647484950505152535414 unmodified lines69707172737374757677777879808182838485858687888914 unmodified lines1041051061071081091081091101111121136 unmodified lines1201211221231241251241251261271281292 unmodified lines1321331341351361361371381391401411421431441451451461471481491501501511521531547 unmodified lines
## Migration Guide
Express 1.x is written to run on-top of the [Connect](http://extjs.github.com/Connect) middlwareframework, thus the `Plugin` has been replaced by Connect's middleware.framework, thus the _Plugin_ has been replaced by Connect's middleware.
### Creating Applications
Previously due to legacy code implemented in the early days of node,10 unmodified lines return 'hello world'; });
Now we utilize the CommonJS module system appropriately, andintroduce `express.createServer()` which accepts the same argumentsas `http.createServer()`:introduce _express.createServer()_ which accepts the same argumentsas _http.createServer()_:
var express = require('express'), app = express.createServer(); 16 unmodified lines use(Logger); use(MethodOverride); use(Cookie);
Which we can now `use()` within our app, or pass to the `express.createServer()` method:Which we can now _use()_ within our app, or pass to the _express.createServer()_ method:
var connect = require('connect');
var app = express.createServer(14 unmodified linesFor documentation on creating Connect middleware visit [Middleware Authoring](http://extjs.github.com/Connect/#Middleware-Authoring).
### Running Applications
Previously a global function `run()`, was available:Previously a global function _run()_, was available:
run();
The new `express.Server` has the same API as `http.Server`,The new _express.Server_ has the same API as _http.Server_,so we can do things like:
app.listen(); app.listen(3000);
### Route Parameters
Previously we could use `this.param()` to attemptPreviously we could use _this.param()_ to attemptfetching a route, query string, or request body parameter:
get('/user/:id', function(){ this.param('id');14 unmodified lines get('/', function(){ this.pass('/foobar'); });
Now Express has access to Connect's `next()` function,which is passed as the fourth and final argument. Calling `next()` willNow Express has access to Connect's _next()_ function,which is passed as the fourth and final argument. Calling _next()_ willpass control to the next _matching route_, or continue down the stackof Connect middleware.
app.get('/user/:id?', function(req, res, params, next){6 unmodified lines
### View Rendering
View filenames no longer take the form _NAME_._TYPE_._ENGINE_,the _Content-Type_ can be set via `ServerResponse#contentType()` or`ServerResponse#header()`. For example what was previously _layout.html.haml_,the _Content-Type_ can be set via _res.contentType()_ or_res.header()_. For example what was previously _layout.html.haml_,should now be _layout.haml_.
Previously a view render looked something like this:
2 unmodified lines locals: { title: 'My Site' } }); });
We now have `ServerResponse#render()`, however the options passed to [haml](http://github.com/visionmedia/haml.js), [jade](http://github.com/visionmedia/jade), and othersWe now have _res.render()_, however the options passed to [haml](http://github.com/visionmedia/haml.js), [jade](http://github.com/visionmedia/jade), and othersremain the same.
app.get('/', function(req, res){ res.render('index.haml', { locals: { title: 'My Site' } }); });
Previously rendering of a collection via `partial()` would look something like this:Previously rendering of a collection via _partial()_ would look something like this:
this.partial('comment.html.haml', { collection: comments });
Although this worked just fine, it was generally to verbose, the similar but new APIlooks like this, as `partial()` is _always_ passed as a local variable:looks like this, as _partial()_ is _always_ passed as a local variable:
partial('comment.haml', { collection: comments });
To make things even less verbose we can assume the extension when ommitted:7 unmodified lines