PlatformExpress
@tsed/platform-express
Usage
typescript
import { PlatformExpress } from "@tsed/platform-express";
See /packages/platform/platform-express/src/types/components/PlatformExpress.ts.
Overview
ts
class PlatformExpress extends PlatformAdapter<Express.Application> {
readonly NAME = "express";
readonly providers: ({
token: typeof PlatformHandler;
useClass: typeof PlatformExpressHandler;
} | {
token: typeof PlatformResponse;
useClass?: undefined;
} | {
token: typeof PlatformRequest;
useClass?: undefined;
} | {
token: typeof PlatformApplication;
useClass?: undefined;
} | {
token: typeof Platform;
useClass?: undefined;
})[];
constructor();
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>>;
beforeLoadRoutes(): Promise<void>;
afterLoadRoutes(): Promise<void>;
mapLayers(layers: PlatformLayer[]): void;
mapHandler(handler: Function, metadata: PlatformHandlerMetadata): (error: unknown, req: any, res: any, next: any) => Promise<Promise<any>>;
useContext(): void;
createApp(): {
app: Express.Express;
callback: () => Express.Express;
};
multipart(options: PlatformMulterSettings): PlatformMulter;
statics(endpoint: string, options: PlatformStaticsOptions): (request: any, response: any, next: any) => void;
bodyParser(type: "json" | "text" | "urlencoded", additionalOptions?: any): any;
}
readonly NAME
ts
readonly NAME = "express";
readonly providers:
ts
readonly providers: ({
token: typeof PlatformHandler;
useClass: typeof PlatformExpressHandler;
} | {
token: typeof PlatformResponse;
useClass?: undefined;
} | {
token: typeof PlatformRequest;
useClass?: undefined;
} | {
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
beforeLoadRoutes
ts
beforeLoadRoutes(): Promise<void>;
afterLoadRoutes
ts
afterLoadRoutes(): Promise<void>;
mapLayers
ts
mapLayers(layers: PlatformLayer[]): void;
mapHandler
ts
mapHandler(handler: Function, metadata: PlatformHandlerMetadata): (error: unknown, req: any, res: any, next: any) => Promise<Promise<any>>;
useContext
ts
useContext(): void;
createApp
ts
createApp(): {
app: Express.Express;
callback: () => Express.Express;
};
multipart
ts
multipart(options: PlatformMulterSettings): PlatformMulter;
statics
ts
statics(endpoint: string, options: PlatformStaticsOptions): (request: any, response: any, next: any) => void;
bodyParser
ts
bodyParser(type: "json" | "text" | "urlencoded", additionalOptions?: any): any;