Skip to main content
Module

x/ako/mod.ts>Application

Expressive HTTP middleware framework for deno using async functions. Aiming to port Koa to Deno.
Latest
class Application
implements IApplication<StateT, CustomT>
extends EventEmitter
import { Application } from "https://deno.land/x/ako@1.0.0-beta.2/mod.ts";

Constructors

new
Application(options?: ApplicationOptions)

Type Parameters

optional
StateT = DefaultState
optional
CustomT = DefaultContext

Properties

context: BaseContext & CustomT
env: string
maxIpsCount: number
middleware: Middleware<StateT, CustomT>[]
proxy: boolean
proxyIpHeader: string
request: BaseRequest
response: BaseResponse
silent: undefined | boolean
subdomainOffset: number

Methods

private
handle(server: Server): Promise<void>
private
handleRequest(ctx: ParameterizedContext<StateT, CustomT>, fnMiddleware: ComposedMiddleware<ParameterizedContext<StateT, CustomT>>): Promise<any>

Handle request in callback.

private
respond(ctx: ParameterizedContext<StateT, CustomT>): Promise<void>
callback(): (req: ServerRequest, res: ServerResponse) => Promise<any>

Return a request handler callback for Deno's std http server.

createContext(req: ServerRequest, res: ServerResponse): ParameterizedContext<StateT, CustomT>
inspect(): string
listen(addr?: string | HTTPOptions): Server

Shorthand for:

serve(addr?: string | HTTPOptions);

onerror(err: any): void
toJSON(): any
use(fn: Middleware<StateT, CustomT>): IApplication<StateT, CustomT>