Add app.redirect shortcut #1384

seanmonstar opened this Issue Oct 24, 2012 · 3 comments

4 participants


I get this boilerplater a lot:

app.get(someRoute, function(req, res) {

How about a shortcut like this:

app.redirect(someRoute, otherRoute);
expressjs member
tj commented Oct 24, 2012

nah easy enough to implement in user-land, app.get('/something', redirect('/here'))


Already implemented?


@visionmedia's redirect could be implemented as:

function redirect(url) {
  return function(req, res) { res.redirect(url) }
// or in coffeescript: redirect = (url) -> (req, res) -> res.redirect url
@tj tj closed this Apr 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment