Browse files

fixed 2.x support

  • Loading branch information...
1 parent 3f0115d commit 9df22a4cf8d462df5d09545c941930f4bb5eeefe @tj tj committed Apr 19, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 index.js
View
11 index.js
@@ -9,7 +9,10 @@
*/
var express = require('express')
- , join = require('path').join;
+ , join = require('path').join
+ , app = express.application
+ ? express.application
+ : express.HTTPServer.prototype;
/**
* Namespace using the given `path`, providing a callback `fn()`,
@@ -50,7 +53,7 @@ exports.__defineGetter__('currentNamespace', function(){
*/
(express.router || express.Router).methods.concat('del').forEach(function(method){
- var orig = express.application[method];
+ var orig = app[method];
exports[method] = function(){
var args = Array.prototype.slice.call(arguments)
, path = args.shift()
@@ -76,6 +79,6 @@ exports.__defineGetter__('currentNamespace', function(){
for (var key in exports) {
var desc = Object.getOwnPropertyDescriptor(exports, key);
- Object.defineProperty(express.application, key, desc);
- Object.defineProperty(express.application, key, desc);
+ Object.defineProperty(app, key, desc);
+ Object.defineProperty(app, key, desc);
}

0 comments on commit 9df22a4

Please sign in to comment.