MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / redirect

Method redirect

packages/rest/src/rest.server.ts:771–779  ·  view source on GitHub ↗

* Register a route redirecting callers to a different URL. * * @example * ```ts * server.redirect('/explorer', '/explorer/'); * ``` * * @param fromPath - URL path of the redirect endpoint * @param toPathOrUrl - Location (URL path or full URL) where to redirect to. * If you

(
    fromPath: string,
    toPathOrUrl: string,
    statusCode?: number,
  )

Source from the content-addressed store, hash-verified

769 * defaults to 303 (See Other).
770 */
771 redirect(
772 fromPath: string,
773 toPathOrUrl: string,
774 statusCode?: number,
775 ): Binding {
776 return this.route(
777 new RedirectRoute(fromPath, this._basePath + toPathOrUrl, statusCode),
778 );
779 }
780
781 /*
782 * Registry of external routes & static assets

Calls 1

routeMethod · 0.95

Tested by

no test coverage detected