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.1.11/mod.ts";

Constructors

new
Context(options: ContextOptions)

Properties

private
_abc: Abc
private
_params: Record<string, string>
private
_request: ServerRequest
private
_response: Response
private
_url: URL
abc: Abc
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
bind<T>(cls: Type<T>): Promise<T>
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<string>
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
render<T>(
name: string,
data?: T,
code?: Status,
): Promise<void>

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

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