File tree Expand file tree Collapse file tree
platform-express/adapters Expand file tree Collapse file tree Original file line number Diff line number Diff 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 => {
Original file line number Diff line number Diff 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 [ ] ) {
You can’t perform that action at this time.
0 commit comments