File tree 2 files changed +7
-3
lines changed
packages/platform-fastify/adapters
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
const fastify = require ( 'fastify' ) ( ) ;
4
4
fastify . get ( '/' , async ( req , reply ) => reply . send ( 'Hello world' ) ) ;
5
- fastify . listen ( 3000 ) ;
5
+ fastify . listen ( {
6
+ port : 3000
7
+ } ) ;
Original file line number Diff line number Diff line change @@ -226,10 +226,12 @@ export class FastifyAdapter<
226
226
public listen ( port : string | number , ...args : any [ ] ) : void {
227
227
const isFirstArgTypeofFunction = typeof args [ 0 ] === 'function' ;
228
228
const callback = isFirstArgTypeofFunction ? args [ 0 ] : args [ 1 ] ;
229
- const options = {
229
+ let options : Record < string , any > = {
230
230
port : + port ,
231
- host : isFirstArgTypeofFunction ? undefined : args [ 0 ] ,
232
231
} ;
232
+ if ( ! isFirstArgTypeofFunction ) {
233
+ options . host = args [ 0 ] ;
234
+ }
233
235
return this . instance . listen ( options , callback ) ;
234
236
}
235
237
You can’t perform that action at this time.
0 commit comments