Skip to main content

createRouteRedirect

Overview

createRouteRedirect

(destinationURL, statusCode?): [`RouteRequestHandler`](../interfaces/RouteRequestHandler.mdx)

A route request handler for redirecting requests.

Parameters

NameTypeDefault valueDescription
destinationURLstringURLundefined
statusCodeResponseRedirectStatus302Default Value 302 MOVED_TEMPORARILY

Returns

RouteRequestHandler

The incoming request handler.

Creating a Worker that just redirects incoming requests.

const redirectToExample = new RedirectHandler('https://example.com')

export default redirectToExample

Defined in

router/functions/createRouteRedirect.ts:36