Skip to main content
Module

x/abc/mod.ts>Context

A better Deno framework to create web application.
Go to Latest
class Context
Re-export
import { Context } from "https://deno.land/x/abc@v0.2.9/mod.ts";

Constructors

new
Context(opts: { app: Application; r: ServerRequest; })

Properties

readonly
cookies: Cookies
readonly
method: string
params: Record<string, string>
readonly
path: string
readonly
queryParams: Record<string, string>
request: ServerRequest
response: Response
url: URL

Methods

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

Sends a blob response with content type and status code.

body(): Promise<Record<string, unknown>>
file(filepath: string): Promise<void>
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.

setCookie(c: Cookie): void

append a Set-Cookie header to the response

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