Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add app.redirect shortcut #1384

Closed
seanmonstar opened this Issue · 3 comments

4 participants

@seanmonstar

I get this boilerplater a lot:

app.get(someRoute, function(req, res) {
  res.redirect(otherRoute);
});

How about a shortcut like this:

app.redirect(someRoute, otherRoute);
@tj
tj commented

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

@alejonext

Already implemented?

@shesek

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.