Permalink
Browse files

Fixed mistake in setting up routes based on route alias assignments.

  • Loading branch information...
1 parent d4bc090 commit d6d7d851b030f98a240a2b3d35bf79c246dc3b15 @bnoguchi committed Apr 5, 2011
Showing with 8 additions and 6 deletions.
  1. +8 −6 lib/everymodule.js
View
14 lib/everymodule.js
@@ -5,7 +5,7 @@ var OAuth = require('oauth').OAuth2
function route (method) {
return function (alias) {
- this._routes[method][alias];
+ this._routes[method].push(alias);
this.configurable(alias);
this._currentRoute = method + '.' + alias;
return this;
@@ -116,10 +116,12 @@ var everyModule = module.exports = {
*/
, routeApp: function (app) {
this.init();
+ var self = this;
for (var method in this._routes) {
- for (var routeAlias in this._routes[method]) {
- app[method](this[routeAlias](), this.routeHandler(method, routeAlias));
- }
+ this._routes[method].forEach( function (routeAlias) {
+ console.log(routeAlias + ' - ' + self[routeAlias]())
+ app[method](self[routeAlias](), self.routeHandler(method, routeAlias));
+ });
}
}
@@ -146,8 +148,8 @@ var everyModule = module.exports = {
// A step object is { accepts: [...], promises: [...] }
, _steps: {}
, _routes: {
- get: {}
- , post: {}
+ get: []
+ , post: []
}
}.configurable('init');

0 comments on commit d6d7d85

Please sign in to comment.