* Creates an instance of NestMicroservice. * * @param moduleCls Entry (root) application module class * @param options Optional microservice configuration * * @returns A promise that, when resolved, * contains a reference to the NestMicroservice instance.
(
moduleCls: IEntryNestModule,
options?: NestMicroserviceOptions & T,
)
| 127 | * contains a reference to the NestMicroservice instance. |
| 128 | */ |
| 129 | public async createMicroservice<T extends object>( |
| 130 | moduleCls: IEntryNestModule, |
| 131 | options?: NestMicroserviceOptions & T, |
| 132 | ): Promise<INestMicroservice> { |
| 133 | const { NestMicroservice } = loadPackage( |
| 134 | '@nestjs/microservices', |
| 135 | 'NestFactory', |
| 136 | () => require('@nestjs/microservices'), |
| 137 | ); |
| 138 | const applicationConfig = new ApplicationConfig(); |
| 139 | const container = new NestContainer(applicationConfig, options); |
| 140 | const graphInspector = this.createGraphInspector(options!, container); |
| 141 | |
| 142 | this.setAbortOnError(options); |
| 143 | this.registerLoggerConfiguration(options); |
| 144 | |
| 145 | await this.initialize( |
| 146 | moduleCls, |
| 147 | container, |
| 148 | graphInspector, |
| 149 | applicationConfig, |
| 150 | options, |
| 151 | ); |
| 152 | return this.createNestInstance<INestMicroservice>( |
| 153 | new NestMicroservice( |
| 154 | container, |
| 155 | options, |
| 156 | graphInspector, |
| 157 | applicationConfig, |
| 158 | ), |
| 159 | ); |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Creates an instance of NestApplicationContext. |
nothing calls this directly
no test coverage detected