Skip to main content
Module

x/abc/context.ts>Context

A better Deno framework to create web application.
Latest
class Context
import { Context } from "https://deno.land/x/abc@v1.3.3/context.ts";

Constructors

new
Context(opts: ContextOptions)
new
Context(c: Context)
new
Context(optionsOrContext: ContextOptions | Context)

Properties

readonly
body: Promise<unknown>
readonly
cookies: Record<string, string>
customContext: any
readonly
method: string
params: Record<string, string>
readonly
path: string
readonly
queryParams: Record<string, string>
request: ServerRequest
response: Response & { headers: Headers; }
url: URL

Methods

blob(
b: Uint8Array | Deno.Reader,
contentType?: string,
code?: Status,
): void

Sends a blob response with content type and status code.

file(filepath: string): Promise<void>
get(key: string | symbol): unknown
html(v: string, code?: Status): void

Sends an HTTP response with status code.

htmlBlob(b: Uint8Array | Deno.Reader, code?: Status): void

Sends an HTTP blob response with status code.

json(v: Record<string, any> | string, code?: Status): void
redirect(url: string, code?): void

Redirects a response to a specific URL. the code defaults to 302 if omitted

render<T>(
name: string,
data?: T,
code?: Status,
): Promise<void>

Renders a template with data and sends a text/html response with status code. renderer must be registered first.

set(key: string | symbol, val: unknown): void
setCookie(c: Cookie): void

append a Set-Cookie header to the response

string(v: string, code?: Status): void