Skip to main content
Module

x/acorn/context.ts>Context

A focused RESTful server framework for Deno 🌰🦕
Go to Latest
class Context
import { Context } from "https://deno.land/x/acorn@0.1.1/context.ts";

An object that provides context for the associated request and response. This is passed as the first argument to every route handler.

Constructors

new
Context(unnamed 0: ContextOptions<BodyType, Params>)

Type Parameters

optional
BodyType = unknown
optional
Params extends Record<string, string> = Record<string, string>

Properties

readonly
cookies: Cookies

The instance of Cookies that allows reading and setting of cookies on the request and response.

readonly
params: Params

Any Params that have been parsed out of the URL requested based on the URL pattern string provided to the Route.

readonly
request: Request

The original Request associated with this request.

readonly
searchParams: Record<string, string>

Any search parameters associated with the request.

Methods

body(): Promise<BodyType | undefined>
url(): URL

Returns the request URL as a parsed URL object.