migrate.md
This file
Path
docs/migrate.md
49 lines · 1.1 KiB · Markdown
Last changed by
Started migration docsTj Holowaychukbefore adoption9e68a5b
History of this fileTake it
Added migrate doc filesTj Holowaychukbefore adoption87bb27c
lines 1–3why, one step back12## Migration Guide3Started migration docsTj Holowaychukbefore adoption9e68a5b
lines 4–49why, one step back4Express 1.x is written to run on-top of the [Connect](http://extjs.github.com/Connect) middlware5framework, thus the `Plugin` has been replaced by Connect's middleware.67### Creating Applications89Previously due to legacy code implemented in the early days of node,10Express unfortunately had some globals. The DSL would previously be11accessed as shown below:1213 require('express');1415 configure(function(){16 // app configuration17 });1819 get('/', function(){20 return 'hello world';21 });2223Now we utilize the CommonJS module system appropriately, and24introduce `express.createServer()` which accepts the same arguments25as `http.createServer()`:2627 var express = require('express'),28 app = express.createServer();29 30 app.configure(function(){31 // app configuration32 });33 34 app.get('/', function(req, res){35 res.send('hello world');36 });373839### Running Applications4041Previously a global function `run()`, was available:4243 run();4445The new `express.Server` has the same API as `http.Server`,46so we can do things like:4748 app.listen();49 app.listen(3000);