| 46 | * @publicApi |
| 47 | */ |
| 48 | export class NestFactoryStatic { |
| 49 | private readonly logger = new Logger('NestFactory', { |
| 50 | timestamp: true, |
| 51 | }); |
| 52 | private abortOnError = true; |
| 53 | private autoFlushLogs = false; |
| 54 | |
| 55 | /** |
| 56 | * Creates an instance of NestApplication. |
| 57 | * |
| 58 | * @param module Entry (root) application module class |
| 59 | * @param options List of options to initialize NestApplication |
| 60 | * |
| 61 | * @returns A promise that, when resolved, |
| 62 | * contains a reference to the NestApplication instance. |
| 63 | */ |
| 64 | public async create<T extends INestApplication = INestApplication>( |
| 65 | module: IEntryNestModule, |
| 66 | options?: NestApplicationOptions, |
| 67 | ): Promise<T>; |
| 68 | /** |
| 69 | * Creates an instance of NestApplication with the specified `httpAdapter`. |
| 70 | * |
| 71 | * @param module Entry (root) application module class |
| 72 | * @param httpAdapter Adapter to proxy the request/response cycle to |
| 73 | * the underlying HTTP server |
| 74 | * @param options List of options to initialize NestApplication |
| 75 | * |
| 76 | * @returns A promise that, when resolved, |
| 77 | * contains a reference to the NestApplication instance. |
| 78 | */ |
| 79 | public async create<T extends INestApplication = INestApplication>( |
| 80 | module: IEntryNestModule, |
| 81 | httpAdapter: AbstractHttpAdapter, |
| 82 | options?: NestApplicationOptions, |
| 83 | ): Promise<T>; |
| 84 | public async create<T extends INestApplication = INestApplication>( |
| 85 | moduleCls: IEntryNestModule, |
| 86 | serverOrOptions?: AbstractHttpAdapter | NestApplicationOptions, |
| 87 | options?: NestApplicationOptions, |
| 88 | ): Promise<T> { |
| 89 | const [httpServer, appOptions] = this.isHttpServer(serverOrOptions!) |
| 90 | ? [serverOrOptions, options] |
| 91 | : [this.createHttpAdapter(), serverOrOptions]; |
| 92 | |
| 93 | const applicationConfig = new ApplicationConfig(); |
| 94 | const container = new NestContainer(applicationConfig, appOptions); |
| 95 | const graphInspector = this.createGraphInspector(appOptions!, container); |
| 96 | |
| 97 | this.setAbortOnError(serverOrOptions, options); |
| 98 | this.registerLoggerConfiguration(appOptions); |
| 99 | |
| 100 | await this.initialize( |
| 101 | moduleCls, |
| 102 | container, |
| 103 | graphInspector, |
| 104 | applicationConfig, |
| 105 | appOptions, |
nothing calls this directly
no outgoing calls
no test coverage detected