Files
Inventory-Manager/db.ts
T

21 lines
666 B
TypeScript
Raw Normal View History

2025-01-12 02:38:12 +00:00
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;