Redirect

The redirect middleware provides res.redirect(), a utility method for redirecting the request to a new Location. Example usage:

exports.handle = function(req, res, next) {
    res.redirect('http://google.com');
}

Redirect also provides "magic" url maps, currently supported is back, which will redirect to the Referrer or Referer headers:

exports.handle = function(req, res, next) {
    res.redirect('back');
}

Optionally you may provide a status code as well, to replace the default of 302:

exports.handle = function(req, res, next) {
    res.redirect('/foo', 301);
}