Skip to content

Commit

Permalink
Fixed a bug that doesn't work with specific method
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Chien committed Aug 2, 2012
1 parent 2037ca8 commit 48409ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/courser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@ Courser.prototype.addHandler = function(routePath, method, routeObj) {
for (var index in routeObj) {
middleware.push(routeObj[index]);
}

/* Take off last element which is not middleware */
middleware.length--;

/* Getting handler from last element */
var handler = routeObj[index];

console.log(middleware);
console.log(handler);

// Using Express API to register route path
self.app[method](routePath, middleware, handler);

} else if (routeObj instanceof Object) {

for (var m in routeObj) {
self.addHandler(routePath, m, routeObj);
self.addHandler(routePath, m, routeObj[m]);
}
}

Expand Down

0 comments on commit 48409ce

Please sign in to comment.