Skip to main content
Module

x/workers_router/index.ts>WorkerRouter#external

A router for Worker Runtimes such and Cloudflare Workers or Service Workers.
Latest
method WorkerRouter.prototype.external
import { WorkerRouter } from "https://deno.land/x/workers_router@v0.3.0-pre.6/index.ts";

Add a route that matches any method with the provided pattern. Note that the pattern here is interpreted as a URLPatternInit which has important implication for matching. Mostly, this is for use in Service Workers to intercept requests to external resources.

The name external is a bit of a misnomer. It simply forwards init to the URLPattern constructor, instead of being limited to the pathname property in the general case.

Type Parameters

X extends RX

Parameters

init: string | URLPatternInit
handler: Handler<X>

Type Parameters

X extends RX

Parameters

init: string | URLPatternInit
middleware: Middleware<RX, X>
handler: Handler<X>