Skip to main content
Module

x/cav/endpoint.ts>ContextArg

A server framework for Deno
Go to Latest
interface ContextArg
import { type ContextArg } from "https://deno.land/x/cav@0.2.0-alpha.7/endpoint.ts";

Arguments available to Context functions.

Properties

req: Request

The Request being handled.

res: ResponseInit & { headers: Headers; }

A ResponseInit applied to the Endpoint's resolved value when packing it into a Response. The Headers are always available.

url: URL

new URL(req.url)

conn: http.ConnInfo

The Deno-provided ConnInfo describing the connection for the request.

path: string

The path that matched the Endpoint's path schema option.

The unprocessed query object associated with this request.

The unprocessed path parameters object captured during routing.

cleanup: (fn: () => Promise<void> | void) => void

When context functions need to run cleanup tasks after the Endpoint has resolved the Response (such as setting cookies, logging performance metrics, etc.), they can use this registration function to do so. Cleanup functions are executed in stack order (last in first out).