Skip to content
Myr

Generating methods based on connect.router.methods

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 5f077e5 · Browse files · 1 file+6 added−3 removed
This commit

State

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

Diff stats

1 file+6 added−3 removed

  • other:+6 added−3 removed

1 file+6 added−3 removed

modified:lib/express/server.js+6 added-3 removed
12 unmodified lines
13 , view = require('./view')14 , connect = require('connect')15 , utils = connect.utils16 , queryString = require('querystring')17 , router = require('connect').router;17 , router = require('connect').router18 , methods = router.methods.concat(['del', 'all']);1920/**21 * Initialize a new `Server` with optional `middleware`.22 *
382 unmodified lines
405};406407// Generate routing methods408408(function(method){409function generateMethod(method){410 Server.prototype[method] = function(path, fn){411 var self = this;412413 // Ensure router is mounted
20 unmodified lines
434 this.routes[method](path, fn);435 return this;436 };437 return arguments.callee;437})('get')('post')('put')('delete')('all');438}439440methods.forEach(generateMethod);441442// Alias delete as "del"443444Server.prototype.del = Server.prototype.delete;