Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Revert change to make enrouten non-enumerable. #41

Merged
merged 1 commit into from
Jun 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,20 @@ function mount(app, options) {
}

// Setup app locals for use in handlers.
// Do this way because app.locals has no prototype. One question this raises is,
// should an app be able to use enrouten multiple times, and if so, should
// app.locals.enrouten routes be merged?
// https://github.com/visionmedia/express/blob/6775658ed5cbac13f2d24c89e23ed967ad6a66ba/lib/application.js#L68
if (!Object.prototype.hasOwnProperty.call(parent.locals, 'enrouten')) {
Object.defineProperty(parent.locals, 'enrouten', {
value: {

routes: router.routes,

path: function path(name, data) {
var route;
route = this.routes[name];
if (typeof route === 'string') {
return reverend(route, data || {});
}
return undefined;
}
parent.locals.enrouten = {

routes: router.routes,

path: function path(name, data) {
var route;
route = this.routes[name];
if (typeof route === 'string') {
return reverend(route, data || {});
}
});
}
return undefined;
}

};

debug('mounting routes at', app.mountpath);
debug(router.routes);
Expand Down
2 changes: 1 addition & 1 deletion lib/directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function traverse(basedir, ancestors, current, fn) {
* for the desired API `function(router)`, determines mount
* point and mounts the router.
* @param router the express Router against which child routers are mounted
* @returns {Function} the implementation function to provide to directory
* @returns {Function} the implementation function to provide to direc`tory
*/
function createFileHandler(router) {

Expand Down