Skip to content
Myr

Renaming usage of old connect middleware

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 bdbacb4 · Browse files · 10 files+21 added−21 removed
This commit

State

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

Diff stats

10 files+21 added−21 removed

  • tests:+3 added−3 removed
  • other:+18 added−18 removed

10 files+21 added−21 removed

modified:bin/express+2 added-2 removed
211 unmodified lines
212 , ''213 , 'app.configure(function(){'214 , ' app.set(\'views\', __dirname + \'/views\');'215 , ' app.set(\'view engine\', \':TEMPLATE\');'216 , ' app.use(express.bodyDecoder());'216 , ' app.use(express.bodyParser());'217 , ' app.use(express.methodOverride());{sess}{css}'218 , ' app.use(app.router);'219 , ' app.use(express.staticProvider(__dirname + \'/public\'));'219 , ' app.use(express.static(__dirname + \'/public\'));'220 , '});'221 , ''222 , 'app.configure(\'development\', function(){'223 , ' app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); '
241 unmodified lines
modified:examples/auth/app.js+2 added-2 removed
modified:examples/blog/app.js+3 added-3 removed
modified:examples/cookies/app.js+2 added-2 removed
12 unmodified lines
13 // Custom logger format14 express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m :response-time' }),1516 // Provides req.cookies17 express.cookieDecoder(),17 express.cookieParser(),1819 // Parses x-www-form-urlencoded request bodies (and json)20 express.bodyDecoder()20 express.bodyParser()21);2223app.get('/', function(req, res){24 if (req.cookies.remember) {
22 unmodified lines
modified:examples/form/app.js+2 added-2 removed
9 unmodified lines
1011// Here we use the bodyDecoder middleware12// to parse urlencoded request bodies13// which populates req.body14app.use(express.bodyDecoder());14app.use(express.bodyParser());15 16// The methodOverride middleware allows us17// to set a hidden input of _method to an arbitrary18// HTTP method to support app.put(), app.del() etc19app.use(express.methodOverride());2021// Required by session22app.use(express.cookieDecoder());22app.use(express.cookieParser());2324// Required by req.flash() for persistent25// notifications26app.use(express.session({ secret: 'keyboard cat' }));
53 unmodified lines
modified:examples/mvc/mvc.js+3 added-3 removed
13 unmodified lines
14// App settings and middleware1516function bootApplication(app) {17 app.use(express.logger({ format: ':method :url :status' }));18 app.use(express.bodyDecoder());18 app.use(express.bodyParser());19 app.use(express.methodOverride());20 app.use(express.cookieDecoder());20 app.use(express.cookieParser());21 app.use(express.session({ secret: 'keyboard cat' }));22 app.use(app.router);23 app.use(express.staticProvider(__dirname + '/public'));23 app.use(express.static(__dirname + '/public'));2425 // Example 500 page26 app.error(function(err, req, res){27 console.dir(err)
121 unmodified lines
modified:examples/route-separation/app.js+2 added-2 removed
14 unmodified lines
15// Config1617app.set('view engine', 'ejs');18app.set('views', __dirname + '/views');19app.use(express.bodyDecoder());19app.use(express.cookieParser());20app.use(express.methodOverride());21app.use(express.staticProvider(__dirname + '/public'));21app.use(express.static(__dirname + '/public'));2223// General2425app.get('/', site.index);
16 unmodified lines
modified:lib/request.js+2 added-2 removed
128 unmodified lines
129 * - Checks urlencoded body params, ex: id=12130 *131 * To utilize urlencoded request bodies, `req.body`132 * should be an object. This can be done by using133 * the `connect.bodyDecoder` middleware.133 * the `connect.bodyParser` middleware.134 *135 * @param {String} name136 * @param {Mixed} defaultValue137 * @return {String}
8 unmodified lines
146 // Query string params147 if (this.query[name] !== undefined) {148 return this.query[name]; 149 }150 // Request body params via connect.bodyDecoder150 // Request body params via connect.bodyParser151 if (this.body && this.body[name] !== undefined) {152 return this.body[name];153 }154 return defaultValue;
136 unmodified lines
modified:test/express.test.js+2 added-2 removed
258 unmodified lines
259 'test #configure() immediate call': function(){260 var app = express.createServer();261262 app.configure(function(){263 app.use(connect.bodyDecoder());263 app.use(connect.bodyParser());264 });265 266 app.post('/', function(req, res){267 res.send(req.param('name') || 'nope');
57 unmodified lines
325 326 'test middleware precedence': function(){327 var app = express.createServer();328 329 app.use(connect.bodyDecoder());329 app.use(connect.bodyParser());330331 assert.equal(2, app.stack.length);332 333 app.post('/', function(req, res){
192 unmodified lines
modified:test/request.test.js+1 added-1 removed
94 unmodified lines
95 },96 97 'test #param()': function(){98 var app = express.createServer(99 connect.bodyDecoder()99 connect.bodyParser()100 );101 102 app.get('/user/:id?', function(req, res){103 res.send('user ' + req.param('id', 'unknown'));
200 unmodified lines