From f0346aff6b18d7f7f738f947492dea2c1eb5eba4 Mon Sep 17 00:00:00 2001 From: joamag Date: Thu, 7 Nov 2019 16:45:50 +0000 Subject: [PATCH] New stop support --- app.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index d13fa63..cc1619b 100644 --- a/app.js +++ b/app.js @@ -89,12 +89,16 @@ app.all("*", (req, res, next) => { (async () => { await lib.start(); - app.listen(lib.conf.PORT, lib.conf.HOST, () => { - try { - util.Logging.info("Listening on " + lib.conf.HOST + ":" + String(lib.conf.PORT)); - lib.init(); - } catch (err) { - util.Logging.error(err); - } - }); + try { + app.listen(lib.conf.PORT, lib.conf.HOST, () => { + try { + util.Logging.info("Listening on " + lib.conf.HOST + ":" + String(lib.conf.PORT)); + lib.init(); + } catch (err) { + util.Logging.error(err); + } + }); + } finally { + await lib.stop(); + } })();