@nestjs/platform-fastify
- Version 8.4.5
- Published
- 42.3 kB
- 7 dependencies
- MIT license
Install
npm i @nestjs/platform-fastify
yarn add @nestjs/platform-fastify
pnpm add @nestjs/platform-fastify
Overview
Nest - modern, fast, powerful node.js web framework (@platform-fastify)
Index
Classes
FastifyAdapter
- applyVersionFilter()
- close()
- createMiddlewareFactory()
- delete()
- enableCors()
- get()
- getHttpServer()
- getInstance()
- getRequestHostname()
- getRequestMethod()
- getRequestUrl()
- getType()
- head()
- init()
- initHttpServer()
- inject()
- instance
- isParserRegistered
- listen()
- options()
- patch()
- post()
- put()
- redirect()
- register()
- registerParserMiddleware()
- registerWithPrefix()
- render()
- reply()
- setErrorHandler()
- setHeader()
- setNotFoundHandler()
- setViewEngine()
- status()
- useStaticAssets()
Interfaces
Classes
class FastifyAdapter
class FastifyAdapter< TServer extends RawServerBase = RawServerDefault, TRawRequest extends FastifyRawRequest<TServer> = FastifyRawRequest<TServer>, TRawResponse extends RawReplyDefaultExpression<TServer> = RawReplyDefaultExpression<TServer>, TRequest extends FastifyRequest< RequestGenericInterface, TServer, TRawRequest > = FastifyRequest<RequestGenericInterface, TServer, TRawRequest>, TReply extends FastifyReply<TServer, TRawRequest, TRawResponse> = FastifyReply< TServer, TRawRequest, TRawResponse >, TInstance extends FastifyInstance< TServer, TRawRequest, TRawResponse > = FastifyInstance<TServer, TRawRequest, TRawResponse>> extends AbstractHttpAdapter<TServer, TRequest, TReply> {}
constructor
constructor(instanceOrOptions?: any);
property instance
protected readonly instance: FastifyInstance<TServer, TRawRequest, TRawResponse>;
property isParserRegistered
readonly isParserRegistered: boolean;
method applyVersionFilter
applyVersionFilter: ( handler: Function, version: VersionValue, versioningOptions: VersioningOptions) => VersionedRoute;
method close
close: () => Promise<undefined>;
method createMiddlewareFactory
createMiddlewareFactory: ( requestMethod: RequestMethod) => Promise<(path: string, callback: Function) => any>;
method delete
delete: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method enableCors
enableCors: (options: CorsOptions | CorsOptionsDelegate<TRequest>) => void;
method get
get: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method getHttpServer
getHttpServer: <T = TServer>() => T;
method getInstance
getInstance: <T = TInstance>() => T;
method getRequestHostname
getRequestHostname: (request: TRequest) => string;
method getRequestMethod
getRequestMethod: (request: TRequest) => string;
method getRequestUrl
getRequestUrl: { (request: TRequest): string; (request: TRawRequest): string };
method getType
getType: () => string;
method head
head: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method init
init: () => Promise<void>;
method initHttpServer
initHttpServer: () => void;
method inject
inject: { (): LightMyRequestChain; (opts: any): Promise<LightMyRequestResponse>;};
method listen
listen: { (port: string | number, callback?: () => void): void; (port: string | number, hostname: string, callback?: () => void): void;};
method options
options: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method patch
patch: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method post
post: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method put
put: ( ...args: any[]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method redirect
redirect: ( response: TReply, statusCode: number, url: string) => FastifyReply<TServer, TRawRequest, TRawResponse, any, unknown>;
method register
register: <TRegister extends Parameters<TInstance['register']>>( plugin: TRegister['0'], opts?: TRegister['1']) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
method registerParserMiddleware
registerParserMiddleware: () => void;
method registerWithPrefix
protected registerWithPrefix: ( factory: | FastifyPluginCallback<any> | FastifyPluginAsync<any> | Promise<{ default: FastifyPluginCallback<any> }> | Promise<{ default: FastifyPluginAsync<any> }>, prefix?: string) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
method render
render: ( response: TReply & { view: Function }, view: string, options: any) => any;
method reply
reply: ( response: TRawResponse | TReply, body: any, statusCode?: number) => FastifyReply<TServer, TRawRequest, TRawResponse, any, unknown>;
method setErrorHandler
setErrorHandler: ( handler: Parameters<TInstance['setErrorHandler']>[0]) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method setHeader
setHeader: ( response: TReply, name: string, value: string) => FastifyReply<TServer, TRawRequest, TRawResponse, any, unknown>;
method setNotFoundHandler
setNotFoundHandler: ( handler: Function) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
method setViewEngine
setViewEngine: ( options: PointOfViewOptions | string) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
method status
status: ( response: TRawResponse | TReply, statusCode: number) => | TRawResponse | FastifyReply< TServer, TRawRequest, TRawResponse, import('fastify/types/route').RouteGenericInterface, unknown >;
method useStaticAssets
useStaticAssets: ( options: FastifyStaticOptions) => FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
Interfaces
interface NestFastifyApplication
interface NestFastifyApplication extends INestApplication {}
method inject
inject: { (): LightMyRequestChain; (opts: any): Promise<LightMyRequestResponse>;};
A wrapper function around native
fastify.inject()
method.Returns
{void}
method listen
listen: { ( port: number | string, callback?: (err: Error, address: string) => void ): Promise<any>; ( port: string | number, address: string, callback?: (err: Error, address: string) => void ): Promise<any>; ( port: string | number, address: string, backlog: number, callback?: (err: Error, address: string) => void ): Promise<any>;};
Starts the application.
Returns
A Promise that, when resolved, is a reference to the underlying HttpServer.
method register
register: <Options extends FastifyPluginOptions = any>( plugin: | FastifyPluginCallback<Options> | FastifyPluginAsync<Options> | Promise<{ default: FastifyPluginCallback<Options> }> | Promise<{ default: FastifyPluginAsync<Options> }>, opts?: FastifyRegisterOptions<Options>) => Promise<FastifyInstance>;
A wrapper function around native
fastify.register()
method. Example `app.register(require('fastify-formbody'))Returns
{Promise}
method setViewEngine
setViewEngine: (options: PointOfViewOptions | string) => this;
Sets a view engine for templates (views), for example:
pug
,handlebars
, orejs
.Don't pass in a string. The string type in the argument is for compatibilility reason and will cause an exception.
Returns
{this}
method useStaticAssets
useStaticAssets: (options: FastifyStaticOptions) => this;
Sets a base directory for public assets. Example
app.useStaticAssets({ root: 'public' })
Returns
{this}
Package Files (3)
Dependencies (7)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/platform-fastify
.
- Markdown[](https://www.jsdocs.io/package/@nestjs/platform-fastify)
- HTML<a href="https://www.jsdocs.io/package/@nestjs/platform-fastify"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1648 ms. - Missing or incorrect documentation? Open an issue for this package.