1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-04 18:35:17 +02:00

SQLite database. App model and controller

This commit is contained in:
unknown 2021-05-10 17:47:26 +02:00
parent 8392c2422a
commit 2acc3b72ec
11 changed files with 1185 additions and 32 deletions

25
db.js Normal file
View file

@ -0,0 +1,25 @@
const { Sequelize } = require('sequelize');
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: './db.sqlite'
});
const connectDB = async () => {
try {
await sequelize.authenticate({ logging: false });
console.log('Connected to database'.cyan.underline);
await sequelize.sync({
// alter: true,
logging: false
});
console.log('All models were synced'.cyan.underline);
} catch (error) {
console.error('Unable to connect to the database:', error);
}
}
module.exports = {
connectDB,
sequelize
};