1 | import { INestApplication, HttpServer } from '@nestjs/common';
|
2 | import { FastifyBodyParser, FastifyInstance, FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifyRegisterOptions, FastifyRequest, FastifyReply, RawServerBase, RawServerDefault } from 'fastify';
|
3 | import { Chain as LightMyRequestChain, InjectOptions, Response as LightMyRequestResponse } from 'light-my-request';
|
4 | import { FastifyStaticOptions, FastifyViewOptions } from './external';
|
5 | import { NestFastifyBodyParserOptions } from './nest-fastify-body-parser-options.interface';
|
6 |
|
7 |
|
8 |
|
9 | export interface NestFastifyApplication<TServer extends RawServerBase = RawServerDefault> extends INestApplication<TServer> {
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 | getHttpAdapter(): HttpServer<FastifyRequest, FastifyReply, FastifyInstance>;
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | register<Options extends FastifyPluginOptions = any>(plugin: FastifyPluginCallback<Options> | FastifyPluginAsync<Options> | Promise<{
|
22 | default: FastifyPluginCallback<Options>;
|
23 | }> | Promise<{
|
24 | default: FastifyPluginAsync<Options>;
|
25 | }>, opts?: FastifyRegisterOptions<Options>): Promise<FastifyInstance>;
|
26 | |
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | useBodyParser<TServer extends RawServerBase = RawServerBase>(type: string | string[] | RegExp, options?: NestFastifyBodyParserOptions, parser?: FastifyBodyParser<Buffer, TServer>): this;
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 | useStaticAssets(options: FastifyStaticOptions): this;
|
48 | |
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | setViewEngine(options: FastifyViewOptions | string): this;
|
55 | |
56 |
|
57 |
|
58 |
|
59 | inject(): LightMyRequestChain;
|
60 | inject(opts: InjectOptions | string): Promise<LightMyRequestResponse>;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | listen(port: number | string, callback?: (err: Error, address: string) => void): Promise<TServer>;
|
66 | listen(port: number | string, address: string, callback?: (err: Error, address: string) => void): Promise<TServer>;
|
67 | listen(port: number | string, address: string, backlog: number, callback?: (err: Error, address: string) => void): Promise<TServer>;
|
68 | }
|