Permalink
Browse files

Fixed for middleware stacked via createServer()

  • Loading branch information...
1 parent 4732185 commit dbf02c231ab70353045f0ba47edd368916113f70 @tj tj committed Dec 29, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/express/server.js
@@ -32,7 +32,7 @@ var Server = exports = module.exports = function Server(middleware){
this.viewHelpers = {};
this.dynamicViewHelpers = {};
this.errorHandlers = [];
- connect.Server.call(this, middleware || []);
+ connect.Server.call(this, []);
// Default "home" to /
this.set('home', '/');
@@ -65,6 +65,13 @@ var Server = exports = module.exports = function Server(middleware){
next();
});
+ // Apply middleware
+ if (middleware) {
+ middleware.forEach(function(fn){
+ self.use(fn);
+ });
+ }
+
// Use router, expose as app.get(), etc
var fn = router(function(app){ self.routes = app; });
this.__defineGetter__('router', function(){

0 comments on commit dbf02c2

Please sign in to comment.