fix(server): command line nestjs does not have http adapter (#7876)

This commit is contained in:
forehalo 2024-08-14 13:41:23 +00:00
parent 57449c1530
commit 9192ac4420
No known key found for this signature in database
GPG Key ID: 56709255DC7EC728

View File

@ -60,6 +60,11 @@ export class SelfhostModule implements OnModuleInit {
onModuleInit() { onModuleInit() {
const staticPath = join(this.config.projectRoot, 'static'); const staticPath = join(this.config.projectRoot, 'static');
// in command line mode
if (!this.adapterHost.httpAdapter) {
return;
}
const app = this.adapterHost.httpAdapter.getInstance<Application>(); const app = this.adapterHost.httpAdapter.getInstance<Application>();
const basePath = this.config.server.path; const basePath = this.config.server.path;