alias comty.js lib

This commit is contained in:
SrGooglo 2023-05-17 16:57:56 +00:00
parent f88fc3df7f
commit ef5eb24af4

View File

@ -5,6 +5,7 @@ import { registerBaseAliases } from "linebridge/dist/server"
registerBaseAliases(undefined, {
"@services": path.resolve(__dirname, "services"),
"comty.js": path.resolve(__dirname, "../../comty.js/src"),
})
// patches
@ -46,9 +47,35 @@ global.isProduction = process.env.NODE_ENV === "production"
import API from "./api"
async function main() {
const mainAPI = new API()
const instance = new API()
await mainAPI.initialize()
await instance.initialize()
// kill on process exit
process.on("exit", () => {
instance.server.close()
process.exit(0)
})
// kill on ctrl+c
process.on("SIGINT", () => {
instance.server.close()
process.exit(0)
})
// kill on uncaught exceptions
process.on("uncaughtException", (error) => {
console.error(`🆘 [FATAL ERROR] >`, error)
instance.server.close()
process.exit(1)
})
// kill on unhandled rejections
process.on("unhandledRejection", (error) => {
console.error(`🆘 [FATAL ERROR] >`, error)
instance.server.close()
process.exit(1)
})
}
main().catch((error) => {