Skip to content

Commit 4558cad

Browse files
committed
fix: quick change to pass more info in the listen event
1 parent b506c6a commit 4558cad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/express-app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ export async function listen<SLocals extends AnyServiceLocals = ServiceLocals<Co
429429
});
430430

431431
await listenPromise;
432-
await service.onListening?.(app, port);
432+
await service.onListening?.(app, { port, protocol: config.certificate ? 'https' : 'http' });
433433
return server;
434434
}
435435

src/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ export interface Service<
7979
// Called after a server is created but before the server starts listening
8080
attachServer?: (app: ServiceExpress<SLocals>, server: Server) => void | Promise<void>;
8181
// Called after the server is listening
82-
onListening?: (app: ServiceExpress<SLocals>, port: number) => void | Promise<void>;
82+
onListening?: (
83+
app: ServiceExpress<SLocals>,
84+
info: { port: number; protocol: 'http' | 'https' },
85+
) => void | Promise<void>;
8386

8487
start(app: ServiceExpress<SLocals>): void | Promise<void>;
8588

0 commit comments

Comments
 (0)