Merge branch 'feature/page-refactor' of github.com:Budibase/budibase into feature/page-refactor

This commit is contained in:
Andrew Kingston 2020-12-04 14:08:13 +00:00
commit 049e046192
1 changed files with 13 additions and 0 deletions

View File

@ -1,4 +1,5 @@
const Koa = require("koa")
const destroyable = require("server-destroy")
const electron = require("electron")
const koaBody = require("koa-body")
const logger = require("koa-pino-logger")
@ -44,6 +45,7 @@ if (electron.app && electron.app.isPackaged) {
}
const server = http.createServer(app.callback())
destroyable(server)
server.on("close", () => console.log("Server Closed"))
@ -51,3 +53,14 @@ module.exports = server.listen(env.PORT || 4001, () => {
console.log(`Budibase running on ${JSON.stringify(server.address())}`)
automations.init()
})
process.on("uncaughtException", err => {
console.error(err)
server.close()
server.destroy()
})
process.on("SIGTERM", () => {
server.close()
server.destroy()
})