This is the code I'm using to start Sequelize and authenticate. I need to await the authenticate() method to make sure database is ready to be used by other app components:
'use strict';
(async () =>
{
let Sequelize=require('sequelize');
let seq = new Sequelize('admin_apptoolset', 'root', 'root',
{
host: 'localhost',
dialect: 'mysql',
operatorsAliases: false,
pool:
{
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
});
console.log("Trying to connect to database...");
await seq.authenticate();
console.log("Connected to database...");
return;
})()
I can see how both console logs are dumped to the console but the process doesn't exit after the return. Shouldn't it work?
Thanks in advance.