migrate.1
This file
Path
docs/migrate.1
78 lines · 1.3 KiB
Last changed by
Started migration docsTj Holowaychukbefore adoption9e68a5b
History of this fileTake it
Added migrate doc filesTj Holowaychukbefore adoption87bb27c
lines 1–6why, one step back1.\" generated with Ronn/v0.6.62.\" http://github.com/rtomayko/ronn/3.4.TH "MIGRATE" "" "July 2010" "" ""5.6.SH "Migration Guide"Started migration docsTj Holowaychukbefore adoption9e68a5b
lines 7–78why, one step back7Express 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\.8.9.SS "Creating Applications"10Previously 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.12.IP "" 413.14.nf1516require(\'express\');1718configure(function(){19 // app configuration20});2122get(\'/\', function(){23 return \'hello world\';24});25.26.fi27.28.IP "" 029.30.P31Now we utilize the CommonJS module system appropriately, and introduce \fBexpress\.createServer()\fR which accepts the same arguments as \fBhttp\.createServer()\fR:32.33.IP "" 434.35.nf3637var express = require(\'express\'),38 app = express\.createServer();3940app\.configure(function(){41 // app configuration42});4344app\.get(\'/\', function(req, res){45 res\.send(\'hello world\');46});47.48.fi49.50.IP "" 051.52.SS "Running Applications"53Previously a global function \fBrun()\fR, was available:54.55.IP "" 456.57.nf5859run();60.61.fi62.63.IP "" 064.65.P66The new \fBexpress\.Server\fR has the same API as \fBhttp\.Server\fR, so we can do things like:67.68.IP "" 469.70.nf7172app\.listen();73app\.listen(3000);74.75.fi76.77.IP "" 078