NestFastifyApplication
interface NestFastifyApplication<TServer extends RawServerBase = RawServerDefault> extends INestApplication {
getHttpAdapter(): HttpServer<FastifyRequest, FastifyReply, FastifyInstance>
register<Options extends FastifyPluginOptions = any>(plugin: any, opts?: FastifyRegisterOptions<Options>): Promise<FastifyInstance>
useBodyParser<TServer extends RawServerBase = RawServerBase>(type: string | RegExp | string[], options?: NestFastifyBodyParserOptions, parser?: FastifyBodyParser<Buffer, TServer>): this
useStaticAssets(options: FastifyStaticOptions): this
enableCors(options?: FastifyCorsOptions): void
setViewEngine(options: string | FastifyViewOptions): this
inject(): LightMyRequestChain
listen(opts: FastifyListenOptions, callback?: (err: Error, address: string) => void): Promise<TServer>
}
Methods
getHttpAdapter() |
---|
Returns the underlying HTTP adapter bounded to a Fastify app. |
ParametersThere are no parameters. Returns
|
register() |
---|
A wrapper function around native |
useBodyParser() | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Register Fastify body parsers on the fly. Will respect
the application's |
||||||||||||
Parameters
Examples
Returns
|
useStaticAssets() |
---|
Sets a base directory for public assets.
Example |
enableCors() |
---|
Enables CORS (Cross-Origin Resource Sharing) |
setViewEngine() | ||||||
---|---|---|---|---|---|---|
Sets a view engine for templates (views), for example: |
||||||
Parameters
Returns
|
||||||
Don't pass in a string. The string type in the argument is for compatibility reason and will cause an exception. |
inject() |
---|
A wrapper function around native |
listen() | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Starts the application. |
||||||||||||||||||||||||||||||||||||||||||||||||
5 overloads...Show All Hide All expand_moreOverload #1
Parameters
Returns
Overload #2
Parameters
Returns
Overload #3
Parameters
Returns
Overload #4
Parameters
Returns
Overload #5
Parameters
Returns
|