PlatformFastify
@tsed/platform-fastify
Usage
typescript
import { PlatformFastify } from "@tsed/platform-fastify";See /packages/platform/platform-fastify/src/components/PlatformFastify.ts.
Overview
ts
class PlatformFastify extends PlatformAdapter<FastifyInstance> {
readonly NAME = "fastify";
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<Fastify.FastifyInstance<Fastify.RawServerDefault, Http.IncomingMessage, Http.ServerResponse<Http.IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>>;
static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<Fastify.FastifyInstance<Fastify.RawServerDefault, Http.IncomingMessage, Http.ServerResponse<Http.IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>>>;
mapLayers(layers: PlatformLayer[]): Promise<void>;
mapHandler(handler: (...args: any[]) => any, metadata: PlatformHandlerMetadata): (...args: any[]) => any;
useContext(): Promise<void>;
createApp(): {
app: Fastify.FastifyInstance<Fastify.RawServerDefault, Http.IncomingMessage, Http.ServerResponse<Http.IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>;
callback: () => (request: IncomingMessage, response: ServerResponse) => Promise<void>;
};
afterLoadRoutes(): Promise<void>;
getServers(): any[];
bodyParser(type: string, opts: Record<string, any> | undefined): any;
statics(endpoint: string, options: PlatformStaticsOptions & FastifyStaticOptions): Promise<void>;
protected compose(layer: PlatformLayer, wildcard?: string): (req: FastifyRequest, _: FastifyReply) => Promise<Promise<any>>;
protected resolvePlugins(): Promise<PlatformFastifyPluginLoadingOptions[]>;
}readonly NAME
ts
readonly NAME = "fastify";static create
ts
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<Fastify.FastifyInstance<Fastify.RawServerDefault, Http.IncomingMessage, Http.ServerResponse<Http.IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>>;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<Fastify.FastifyInstance<Fastify.RawServerDefault, Http.IncomingMessage, Http.ServerResponse<Http.IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>>>;Bootstrap a server application
mapLayers
ts
mapLayers(layers: PlatformLayer[]): Promise<void>;mapHandler
ts
mapHandler(handler: (...args: any[]) => any, metadata: PlatformHandlerMetadata): (...args: any[]) => any;useContext
ts
useContext(): Promise<void>;createApp
ts
createApp(): {
app: Fastify.FastifyInstance<Fastify.RawServerDefault, Http.IncomingMessage, Http.ServerResponse<Http.IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>;
callback: () => (request: IncomingMessage, response: ServerResponse) => Promise<void>;
};afterLoadRoutes
ts
afterLoadRoutes(): Promise<void>;getServers
ts
getServers(): any[];bodyParser
ts
bodyParser(type: string, opts: Record<string, any> | undefined): any;statics
ts
statics(endpoint: string, options: PlatformStaticsOptions & FastifyStaticOptions): Promise<void>;protected compose
ts
protected compose(layer: PlatformLayer, wildcard?: string): (req: FastifyRequest, _: FastifyReply) => Promise<Promise<any>>;protected resolvePlugins
ts
protected resolvePlugins(): Promise<PlatformFastifyPluginLoadingOptions[]>;