Skip to content

Commit

Permalink
Style: injection of dependency on start
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-0x29a committed Sep 20, 2024
1 parent 4775cb7 commit 84687af
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ function loadEntities (core: WebCore) {
})
}

SequelizeAuth.then(() => {
const authenticateOrm = (callback: () => void) => {
SequelizeAuth.then(() => {
callback()
}).catch(() => {
throw new Error("Failed to connect to the database.")
})
}

function startServer () {
const Core = new WebCore()

loadEntities(Core)

Core.start()
}).catch(() => {
throw new Error("Failed to connect to the database.")
})
}

authenticateOrm(startServer)

0 comments on commit 84687af

Please sign in to comment.