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