Page Contents
Home > @loopback/rest > RestApplication > redirect
RestApplication.redirect() method
Register a route redirecting callers to a different URL.
Signature:
redirect(fromPath: string, toPathOrUrl: string, statusCode?: number): Binding;
Parameters
| Parameter | Type | Description |
|---|---|---|
|
fromPath |
string |
URL path of the redirect endpoint |
|
toPathOrUrl |
string |
Location (URL path or full URL) where to redirect to. If your server is configured with a custom |
|
statusCode |
number |
(Optional) HTTP status code to respond with, defaults to 303 (See Other). |
Returns:
Example
app.redirect('/explorer', '/explorer/');