Permalink
Browse files

Interface for adding routes

  • Loading branch information...
1 parent b82f638 commit 3ee81af70b1d9d0ec450844ec1c9ae77f0702bb3 @1602 committed Dec 22, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/railway_routes.js
View
@@ -315,3 +315,12 @@ Map.prototype.subroutes = function (name, subroutes) {
this.globPath = oldGlobPath;
};
+Map.prototype.addRoutes = function (path) {
+ var routes = require(path);
+ routes = routes.routes || routes;
+ if (typeof routes !== 'function') {
+ throw new Error('Routes is not defined in ' + path);
+ }
+ return routes(this);
+};
+

0 comments on commit 3ee81af

Please sign in to comment.