-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
Open
Labels
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));
}
apexskier, melv-n, manvydasu and cj-christoph-gysinsnawaz