node.js - Server-side "redirect" in express.js -
say i've got route set /x/aaa. how requests /y/aaa handled /x/aaa code knowing came via /y/ can, example, enable debugging.
i'm after server-side redirects, similar server.transfer in asp.net.
that's not common thing in express (and hence, there's no obvious solution).
you of course use same handler both routes:
var handler = function(req, res) { ... }; app.get('/x/aaa', handler); app.get('/y/aaa', handler);
in handler, check req.path
see route called.
Comments
Post a Comment