You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
541 B
17 lines
541 B
import { Sequelize, DataTypes } from "sequelize";
|
|
import path from "path";
|
|
export const sequelize = new Sequelize({
|
|
dialect: "sqlite",
|
|
storage: path.resolve(__dirname, "./data.db"),
|
|
logging: loggerSQL.debug.bind(loggerSQL) // Alternative way to use custom logger, displays all messages
|
|
});
|
|
|
|
export async function connect(){
|
|
try {
|
|
await sequelize.authenticate();
|
|
console.log('Connection has been established successfully.');
|
|
} catch (error) {
|
|
console.error('Unable to connect to the database:', error);
|
|
}
|
|
}
|
|
|
|
|