UNPKG

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