about summary refs log tree commit diff stats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index 2c75554..b7bc1a3 100644
--- a/src/index.js
+++ b/src/index.js
@@ -11,8 +11,12 @@ if (targetDir) {
 
 const app = require("./app.js");
 
-module.exports = app;
-
-app.listen(PORT, () => {
-  console.log(`App listening on port ${PORT}`);
-});
+(async function() {
+  try {
+    (await app()).listen(PORT, () => {
+      console.log(`App listening on port ${PORT}`);
+    });
+  } catch (error) {
+    console.error("App startup error", error);
+  }
+})();