From 6b3fdb746c64a583110e3e97ad3c5f2ef3c7263f Mon Sep 17 00:00:00 2001 From: cha0s Date: Thu, 7 Jan 2021 01:23:01 -0600 Subject: [PATCH] refactor: http listen --- packages/http/src/http.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/http/src/http.js b/packages/http/src/http.js index be9e29d..6edb407 100644 --- a/packages/http/src/http.js +++ b/packages/http/src/http.js @@ -92,7 +92,13 @@ export const createHttpServer = async (latus) => { }); } return new Promise((resolve, reject) => { - httpServer.listen(HTTP_PORT || port, HTTP_HOST || host, async (error) => { + const serverPort = HTTP_PORT || port; + const serverHost = HTTP_HOST || host; + const args = [serverPort]; + if (serverHost) { + args.push(serverHost); + } + args.push(async (error) => { if (error) { return reject(error); } @@ -101,6 +107,7 @@ export const createHttpServer = async (latus) => { resolve(); return undefined; }); + httpServer.listen(...args); }); };