From b7c4aca8181a6dea37cc588cbd1936611fd4b321 Mon Sep 17 00:00:00 2001 From: FahrezaIsnanto Date: Wed, 14 Dec 2022 10:34:49 +0700 Subject: [PATCH] add bind host http server for docker container --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 00b4700..45dba0f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,8 +12,9 @@ const readableToString: (readable: IncomingMessage) => Promise = (readab readable.on('error', (err) => reject(err)) }) -export default (render: AppCallback, port?: number): void => { +export default (render: AppCallback, port?: number, host?: string): void => { const _port = port || 13714 + const _host = host || 'localhost' const routes: Record = { '/health' : async () => ({ status: 'OK', timestamp: Date.now() }), @@ -33,7 +34,7 @@ export default (render: AppCallback, port?: number): void => { } response.end() - }).listen(_port, () => console.log('Inertia SSR server started.')) + }).listen(_port, _host, () => console.log('Inertia SSR server started.')) console.log(`Starting SSR server on port ${_port}...`) }