refactor: http listen
This commit is contained in:
parent
c6d77047f5
commit
6b3fdb746c
|
@ -92,7 +92,13 @@ export const createHttpServer = async (latus) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (error) {
|
||||||
return reject(error);
|
return reject(error);
|
||||||
}
|
}
|
||||||
|
@ -101,6 +107,7 @@ export const createHttpServer = async (latus) => {
|
||||||
resolve();
|
resolve();
|
||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
|
httpServer.listen(...args);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user