Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide req.matchedRoutes to middlewares #7

Merged
merged 6 commits into from
Aug 14, 2017
Merged

Conversation

haysmike
Copy link
Contributor

req.matchedRoutes is a proposed addition to express v5.

Doing this because in goodeggs-stats, we need to know what route we are currently on when we are publishing metrics to librato. In express v4 there is no mechanism to do this, if the routes have parameters in them (like :id, etc) or if they have nesting (given /foo/bar, the middleware for /foo has no knowledge of /bar and vice-versa).

Mike Hays added 3 commits August 11, 2017 15:17
- set `__mountpath` in `.use()`
- override `process_params` to add `req.matchedRoutes`

`req.matchedRoutes` is a proposed addition to express v5:
pillarjs/router#34

Doing this because in goodeggs-stats, we need to know what route we are
currently on when we are publishing metrics to librato. In express v4
there is no mechanism to do this, if the routes have parameters in them
(like :id, etc) or if they have nesting (given /foo/bar, the middleware
for /foo has no knowledge of /bar and vice-versa).
@haysmike
Copy link
Contributor Author

🍐 w/ @demands
👍 by @demands

@haysmike haysmike merged commit 976c566 into master Aug 14, 2017
@haysmike haysmike deleted the provide-matched-route branch August 14, 2017 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant