Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/cav/endpoints.ts>ResolveArg

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

Arguments available to the resolve function of an endpoint.

Type Parameters

optional
Schema = unknown

Properties

schema: Schema

The schema used to create this resolver's endpoint. If no schema was used, this will be an empty object.

req: Request

The Request being handled.

res: ResponseInit & { headers: Headers; }

A ResponseInit applied to the endpoint response after resolving and packing the value to send to the client. The Headers object is always available.

url: URL

new URL(req.url)

conn: http.ConnInfo

Connection information provided by Deno.

cookies: CookieJar

The CookieJar created after the endpoint matched with the Request.

path: string

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

The parsed path groups captured while routing the request.

The context created after the endpoint matched the Request.

The parsed query string parameters.

The parsed Request body, if any.

asset: (opt: ServeAssetOptions) => Promise<Response>

Returns a Response created using an asset from an assets directory.

redirect: (to: string, status?: number) => Response

Returns a redirect Response. If the redirect path doesn't specify an origin, the origin of the current request is used. If the path starts with a ".", it is joined with the pathname of the Request url to get the final redirect path. The default status is 302.