我正在使用sequelize作为ORM在节点中开发一个应用程序,我需要该sequelize在应用程序启动后不要尝试连接到数据库,我需要在填写与连接数据的表格后这样做数据库
const Sequelize = require('sequelize');
const config = require('./config');
const sequelize = new Sequelize(
config.dbname,
config.userSQL,
config.passwordSQL,
{
host: config.servidor,
dialect: 'mssql',
pool: {
max: 5,
min: 0,
idle: 20000,
},
define: {
timestamps: false,
},
logging: false,
},
);
sequelize
.authenticate()
.then(() => {
console.log('connection.');
})
.catch(err => {
console.error('ERROR CONNECTIONS', err);
});
module.exports = sequelize;