PlatformKoa
@tsed/platform-koa
Usage
typescript
import { PlatformKoa } from "@tsed/platform-koa";
See /packages/platform/platform-koa/src/types/components/PlatformKoa.ts.
Overview
ts
class PlatformKoa extends PlatformAdapter<Koa> {
readonly NAME = "koa";
readonly providers: ({
token: typeof PlatformResponse;
useClass: typeof PlatformKoaResponse;
} | {
token: typeof PlatformRequest;
useClass: typeof PlatformKoaRequest;
} | {
token: typeof PlatformHandler;
useClass: typeof PlatformKoaHandler;
} | {
token: typeof PlatformApplication;
useClass?: undefined;
} | {
token: typeof Platform;
useClass?: undefined;
})[];
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<TsED.Application>;
static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<TsED.Application>>;
onInit(): void;
mapLayers(layers: PlatformLayer[]): void;
mapHandler(handler: Function, metadata: PlatformHandlerMetadata): (koaContext: Koa.Context, next: Koa.Next) => Promise<any>;
useContext(): void;
createApp(): {
app: Koa<Koa.DefaultState, Koa.DefaultContext>;
callback(): (req: import("http").IncomingMessage | import("http2").Http2ServerRequest, res: import("http").ServerResponse<import("http").IncomingMessage> | import("http2").Http2ServerResponse<import("http2").Http2ServerRequest>) => Promise<void>;
};
multipart(options: PlatformMulterSettings): PlatformMulter;
statics(endpoint: string, options: PlatformStaticsOptions): any;
bodyParser(_: "json" | "urlencoded" | "raw" | "text", additionalOptions?: any): any;
}
readonly NAME
ts
readonly NAME = "koa";
readonly providers:
ts
readonly providers: ({
token: typeof PlatformResponse;
useClass: typeof PlatformKoaResponse;
} | {
token: typeof PlatformRequest;
useClass: typeof PlatformKoaRequest;
} | {
token: typeof PlatformHandler;
useClass: typeof PlatformKoaHandler;
} | {
token: typeof PlatformApplication;
useClass?: undefined;
} | {
token: typeof Platform;
useClass?: undefined;
})[];
static create
ts
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<TsED.Application>;
Create new serverless application. In this mode, the component scan are disabled.
static bootstrap
ts
static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<TsED.Application>>;
Bootstrap a server application
onInit
ts
onInit(): void;
mapLayers
ts
mapLayers(layers: PlatformLayer[]): void;
mapHandler
ts
mapHandler(handler: Function, metadata: PlatformHandlerMetadata): (koaContext: Koa.Context, next: Koa.Next) => Promise<any>;
useContext
ts
useContext(): void;
createApp
ts
createApp(): {
app: Koa<Koa.DefaultState, Koa.DefaultContext>;
callback(): (req: import("http").IncomingMessage | import("http2").Http2ServerRequest, res: import("http").ServerResponse<import("http").IncomingMessage> | import("http2").Http2ServerResponse<import("http2").Http2ServerRequest>) => Promise<void>;
};
multipart
ts
multipart(options: PlatformMulterSettings): PlatformMulter;
statics
ts
statics(endpoint: string, options: PlatformStaticsOptions): any;
bodyParser
ts
bodyParser(_: "json" | "urlencoded" | "raw" | "text", additionalOptions?: any): any;