Open scottkf opened 12 years ago
A request has a redirect method already see the docs.
I'm not entirely sure what you mean by "programmatically redirect something, but change a parameter", do you want to re-run the same route but add a parameter if it is missing? This could be achieved with some route middleware, e.g.
var paramChanger = function (req, next) {
req.params.foo += 1
next(req)
}
this.get('/somepath', paramChanger, function (req) {
// do whatever with req.params.foo now
})
More on this in the docs. This wouldn't re-run the route but do the massaging of the params before your route is run…
Is there an easy way to accomplish this without reusing the code in the
prototype.run
function? It doesn't seem like it, but I could be blind! I'm trying to programmatically redirect something, but change a parameter.