Skip to content

Commit fc4aaf2

Browse files
bugfix(fastify): not registered fastify routes nestjs#1703
1 parent 7ee2f58 commit fc4aaf2

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/core/nest-application.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class NestApplication extends NestApplicationContext
211211
public async listen(port: number | string, ...args: any[]): Promise<any> {
212212
!this.isInitialized && (await this.init());
213213

214-
this.httpServer.listen(port, ...args);
214+
this.httpAdapter.listen(port, ...args);
215215
return this.httpServer;
216216
}
217217

@@ -223,7 +223,7 @@ export class NestApplication extends NestApplicationContext
223223

224224
public async close(): Promise<any> {
225225
this.socketModule && (await this.socketModule.close());
226-
this.httpServer && this.httpServer.close();
226+
this.httpAdapter && this.httpAdapter.close();
227227

228228
await Promise.all(
229229
iterate(this.microservices).map(async microservice => {

packages/platform-express/adapters/express-adapter.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ export class ExpressAdapter extends AbstractHttpAdapter {
4242
return response.set(name, value);
4343
}
4444

45+
public listen(port: string | number, callback?: () => void);
46+
public listen(port: string | number, hostname: string, callback?: () => void);
47+
public listen(port: any, hostname?: any, callback?: any) {
48+
return this.httpServer.listen(port, hostname, callback);
49+
}
50+
4551
public close() {
46-
return this.instance.close();
52+
return this.httpServer ? this.httpServer.close() : undefined;
4753
}
4854

4955
public set(...args: any[]) {

0 commit comments

Comments
 (0)