UNPKG

2.9 kBTypeScriptView Raw
1import { CanActivate, ExceptionFilter, HttpServer, INestApplication, INestMicroservice, NestInterceptor, PipeTransform, WebSocketAdapter } from '@nestjs/common';
2import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
3import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
4import { AbstractHttpAdapter } from './adapters';
5import { ApplicationConfig } from './application-config';
6import { NestContainer } from './injector/container';
7import { NestApplicationContext } from './nest-application-context';
8/**
9 * @publicApi
10 */
11export declare class NestApplication extends NestApplicationContext implements INestApplication {
12 private readonly httpAdapter;
13 private readonly config;
14 private readonly appOptions;
15 private readonly logger;
16 private readonly middlewareModule;
17 private readonly middlewareContainer;
18 private readonly microservicesModule;
19 private readonly socketModule;
20 private readonly routesResolver;
21 private readonly microservices;
22 private httpServer;
23 private isListening;
24 constructor(container: NestContainer, httpAdapter: HttpServer, config: ApplicationConfig, appOptions?: NestApplicationOptions);
25 protected dispose(): Promise<void>;
26 getHttpAdapter(): AbstractHttpAdapter;
27 registerHttpServer(): void;
28 getUnderlyingHttpServer<T>(): T;
29 applyOptions(): void;
30 createServer<T = any>(): T;
31 registerModules(): Promise<void>;
32 registerWsModule(): void;
33 init(): Promise<this>;
34 registerParserMiddleware(): void;
35 registerRouter(): Promise<void>;
36 registerRouterHooks(): Promise<void>;
37 connectMicroservice<T extends object>(options: T): INestMicroservice;
38 getMicroservices(): INestMicroservice[];
39 getHttpServer(): any;
40 startAllMicroservices(callback?: () => void): this;
41 startAllMicroservicesAsync(): Promise<void>;
42 use(...args: [any, any?]): this;
43 enableCors(options?: CorsOptions): void;
44 listen(port: number | string, callback?: () => void): Promise<any>;
45 listen(port: number | string, hostname: string, callback?: () => void): Promise<any>;
46 listenAsync(port: number | string, hostname?: string): Promise<any>;
47 getUrl(): Promise<string>;
48 setGlobalPrefix(prefix: string): this;
49 useWebSocketAdapter(adapter: WebSocketAdapter): this;
50 useGlobalFilters(...filters: ExceptionFilter[]): this;
51 useGlobalPipes(...pipes: PipeTransform<any>[]): this;
52 useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
53 useGlobalGuards(...guards: CanActivate[]): this;
54 useStaticAssets(options: any): this;
55 useStaticAssets(path: string, options?: any): this;
56 setBaseViewsDir(path: string | string[]): this;
57 setViewEngine(engineOrOptions: any): this;
58 private host;
59 private getProtocol;
60 private registerMiddleware;
61 private listenToPromise;
62}