21 lines
666 B
TypeScript
21 lines
666 B
TypeScript
const { Sequelize } = require('sequelize');
|
|||
|
|
|
||
|
|
// Replace with your MariaDB credentials
|
||
|
|
const sequelize = new Sequelize('inventory_db', 'inventory_db', 'Vofato40', {
|
||
|
|
host: '68.183.4.81', // Use your MariaDB server's address if not localhost
|
||
|
|
dialect: 'mariadb', // Specify MariaDB dialect
|
||
|
|
logging: false, // Disable query logging for cleaner output
|
||
|
|
port: 3306,
|
||
|
|
});
|
||
|
|
|
||
|
|
// Test connection
|
||
|
|
(async () => {
|
||
|
|
try {
|
||
|
|
await sequelize.authenticate();
|
||
|
|
console.log('Connection to MariaDB established successfully.');
|
||
|
|
} catch (error) {
|
||
|
|
console.error('Unable to connect to the database:', error);
|
||
|
|
}
|
||
|
|
})();
|
||
|
|
|
||
|
|
module.exports = sequelize;
|