Skip to main content
Module

x/http_fns/pattern.ts>byPattern

A bunch of functions for building HTTP servers
Go to Latest
function byPattern
import { byPattern } from "https://deno.land/x/http_fns@v0.0.27/pattern.ts";

Create a Request handler that matches the URL of the Request based on a URLPattern.

Type Parameters

A extends unknown[]

Parameters

pattern: RoutePattern

the URL pattern to match against the Request URL

handler: (
request: Request,
...args: A,
) => Awaitable<Response | null>

handler to call if the pattern matches, it should take the Request and the URLPatternResult as arguments