I wanna override url before app.router parsed.
Insert path like http://example.com/#{uid}/#{trueURI}
should to be http://example.com/#{trueURI}
I use following code:
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(cookieParser);
app.use(express.session());
app.use(function (req, res, next) {
paths = req.path.split('/');
paths.shift();
req.session.uid = paths[0];
paths.shift();
req.path = "/" + paths.join('/'); // Cannot set this
next();
});
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);
app.use(require('stylus').middleware(__dirname + '/public'));
The req.path only have getter, but setter is unused.
So, how could I replace url every request in express/connect framework?
Thanks for your read.