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

Is there a way to create a shortcut for locals.enrouten.path as locals.url? #56

Closed
Dexus opened this issue Sep 28, 2014 · 3 comments
Closed

Comments

@Dexus
Copy link

Dexus commented Sep 28, 2014

Hey,

is there a way to create a shortcut for locals.enrouten.path as locals.url?

i try to set app.locals.url = app.locals.enrouten.path, but thats not working for me.

@totherik
Copy link
Contributor

Unfortunately, path in this context is a method. The app.locals.enrouten property is an object and the path method refers to this internally. As such if you just copy the function it will lose the context it needs to correctly resolve.

@Dexus
Copy link
Author

Dexus commented Oct 1, 2014

okay, i have clone the enrouten.path function and change the this context to the real one. Its not realy nice to do so, but for now its doing that what i need.

It will be a nice to have.

@totherik
Copy link
Contributor

totherik commented Oct 1, 2014

Thanks for the follow up @Dexus. This functionality was namespaced under "enrouten" to prevent naming collisions on app or res locals. Just naming the property "url" would be too generic and sure to cause naming conflicts, so it's unlikely we will go that route. If your age other thoughts on how to simplify the location of this functionality, feel free to go ahead and file an issue with that proposal. Thanks, again.

@totherik totherik closed this as completed Oct 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants