base: Make run smarter when creating server

This commit is contained in:
Jonatan Nilsson 2023-11-07 20:47:45 +00:00
parent 3dbcc18da8
commit 86394efb1f

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 Promise.all([
this.runCreateServer(),
this.runCreateDatabase(),
]).then(() => {
return this.runRegisterRoutes()
}).then(() => {
return this.runStartListen()
})
}
}