base: Make run smarter when creating server

master
Jonatan Nilsson 2023-11-07 20:47:45 +00:00
parent 3dbcc18da8
commit 86394efb1f
1 changed files with 8 additions and 7 deletions

View File

@ -43,9 +43,6 @@ export default class Server {
// Create our server
this.flaska = new Flaska(this.flaskaOptions, this.http)
// Create our database pool
this.runCreateDatabase()
// configure our server
if (config.get('NODE_ENV') === 'development') {
this.flaska.devMode()
@ -121,9 +118,13 @@ export default class Server {
}
run() {
this.runCreateServer()
this.runRegisterRoutes()
return this.runStartListen()
return Promise.all([
this.runCreateServer(),
this.runCreateDatabase(),
]).then(() => {
return this.runRegisterRoutes()
}).then(() => {
return this.runStartListen()
})
}
}