Instance Method
redirect(to:redirectType:)
Creates a redirect
Response.Parameters
locationThe path to redirect to
redirectTypeThe type of redirect to perform
Return Value
A response that redirects the client to the specified location
Discussion
router.get("redirect") { req in
return req.redirect(to: "https://vapor.codes")
}
Set type to ‘.permanently’ to allow caching to automatically redirect from browsers. Defaulting to non-permanent to prevent unexpected caching.