Server-side "redirect" in express.js

Say I've got a route set up for /x/AAA. How do I get requests for /y/AAA to be handled as for /x/AAA but with the code also knowing that it originally came via /y/ so that it can, for example, enable debugging.

I'm basically after server-side redirects, similar to Server.Transfer in ASP.NET.

That's not a very common thing in Express (and hence, there's no obvious solution).

You could of course use the same handler for both routes:

var handler = function(req, res) {
  ...
};
app.get('/x/AAA', handler);
app.get('/y/AAA', handler);

In your handler, you could check req.path to see which route was called.