Replacing a parameter in the current route #53

scottkf opened this Issue Sep 4, 2012 · 1 comment


None yet
2 participants

scottkf commented Sep 4, 2012

Is there an easy way to accomplish this without reusing the code in the function? It doesn't seem like it, but I could be blind! I'm trying to programmatically redirect something, but change a parameter.


olivernn commented Sep 7, 2012

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) { += 1

this.get('/somepath', paramChanger, function (req) {
  // do whatever with 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…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment