mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
alias comty.js
lib
This commit is contained in:
parent
f88fc3df7f
commit
ef5eb24af4
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user