Add originalRoute like originalUrl
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
In a request we can get the originalUrl, which is the complete URL for the request after it has travelled through nested routes.
But I think an originalRoute would be at least as usefull, especially for request logging.
I don't think it should be that difficult to add.
Currently I've made a simple hack to accomplish this, but I rather see it built-in.
```
var _ = require('lodash');
var express = require('express');
var Router = express.Router;
var Router_process_params = Router.process_params;
Router.process_params = function (layer, called, req, res, done) {
req.originalRoute = (req.originalRoute || '') + (req.route && req.route.path || layer.path || '');
return Router_process_params.apply(this, _.toArray(arguments));
}
```
Contributor guide
Assessment
This issue has not been assessed yet.