Skip to main content
Module

x/cav/mod.ts>CtxArg

A server framework for Deno
Go to Latest
interface CtxArg
import { type CtxArg } from "https://deno.land/x/cav@0.0.8/mod.ts";

Arguments available to the Ctx function of an Rpc.

Properties

req: Request

The incoming Request.

res: Headers

The outgoing Headers, applied before a Response is returned.

url: URL

The WHATWG URL for the current Request.

conn: http.ConnInfo

The Deno-provided ConnInfo associated with the request.

path: string

The path that matched the Rpc's path init option.

query: Record<string, string | string[]>

The raw query object associated with this request.

groups: Record<string, string>

The raw path groups object associated with this request.

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

Some Ctx functions may need to run cleanup tasks once a Response is ready to send back to the client. Functions registered with "whenDone" will be added to a stack structure, and just before the Rpc returns a response, each cleanup function will be popped from the stack and executed.