Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/keywork/router/mod.ts>createRouteRedirect

A library for building V8 Isolate web apps on Cloudflare Workers, Deno, and Node.JS
Latest
function createRouteRedirect
import { createRouteRedirect } from "https://deno.land/x/keywork@v6.2.1/router/mod.ts";

A route request handler for redirecting requests.

Parameters

destinationURL: string | URL
optional
statusCode: ResponseRedirectStatus = [UNSUPPORTED]

Returns

RouteRequestHandler

The incoming request handler.

Creating a Worker that just redirects incoming requests.

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

export default redirectToExample