Skip to main content
Module

x/http_fns/handle.ts>handle

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

Create a Request handler that tries each handler and then a fallback as a last resort.

This is just a combination of cascade and withFallback for convenience for creating your top-level handler.

Type Parameters

A extends unknown[]

Parameters

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

the array of handler functions to be called in turn until one returns a Response

optional
fallback: (request: Request, ...args: A) => Awaitable<Response> = [UNSUPPORTED]

the handler called if none of the handlers above returns a Response, this optional and defaults to a Not Found response.