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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -