Skip to main content
Module

x/dero/types.ts

Fast web framework for Deno (support native HTTP/2 Hyper and std/http).
Go to Latest
File
export type TBody = Uint8Array | Deno.Reader | string;export type NextFunction = (err?: any) => void;export interface HttpRequest { respond: (r: any) => Promise<void>; pond: (body?: TBody | { [k: string]: any } | null, opts?: PondOptions) => Promise<void>; proto: string; url: string; conn: Deno.Conn; isHttps: boolean | undefined; method: string; headers: Headers; body: Deno.Reader | null; originalUrl: string; params: { [k: string]: any }; _parsedUrl: { [k: string]: any }; path: string; query: { [k: string]: any }; search: string | null; getBaseUrl: () => string; [k: string]: any;};export interface HttpResponse { locals: any; opts: PondOptions; header: (key?: { [k: string]: any } | string, value?: any) => this | (this & Headers) | (this & string); status: (code?: number) => this | (this & number); type: (contentType: string) => this; body: (body?: TBody | { [k: string]: any } | null) => Promise<void>; return: ((body: any) => any)[]; [k: string]: any;};export type PondOptions = { status?: number; headers?: Headers; [key: string]: any;};export type DeroConfig = { useParseQuery?: (query: string) => any; useParseUrl?: (req: HttpRequest) => any; useNativeHttp?: boolean;};export type THandler< Req extends HttpRequest = HttpRequest, Res extends HttpResponse = HttpResponse > = (req: Req, res: Res, next: NextFunction) => any;export type THandlers< Req extends HttpRequest = HttpRequest, Res extends HttpResponse = HttpResponse > = Array<THandler<Req, Res> | THandler<Req, Res>[]>;export type DeroRoutersControllers< Req extends HttpRequest = HttpRequest, Res extends HttpResponse = HttpResponse > = { class?: { new(...args: any): { [k: string]: any } }[] | { new(...args: any): { [k: string]: any } }; wares?: THandler<Req, Res> | THandlers<Req, Res>; prefix?: string | undefined; routes?: { [k: string]: any }[]; };