Answer the question
In order to leave comments, you need to log in
How to properly reconnect in sequalize?
help plz
Let's say I connect to the database and the server is unavailable.
How to organize a reconnect? Is there some kind of built-in API?
const sequelize = new Sequelize('Education', 'root','', {
host: '127.0.0.1',
dialect: 'mysql'
} );
//test db
sequelize
.authenticate()
.then(() => {
console.log('Connection has been established successfully.');
})
.catch(err => {
console.error('Unable to connect to the database:', err);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question