index.js 515 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Sequelize } from "sequelize";
import UserModel from "./user.model.js";
import RoomModel from "./room.model.js";

const env = process.env.NODE_ENV || "development";
import configs from "../config/config.js";
const config = configs[env];

const sequelize = new Sequelize(
  config.database,
  config.username,
  config.password,
  { host: config.host, dialect: config.dialect }
);

const User = UserModel(sequelize);
const Room = RoomModel(sequelize);

User.hasMany(Room);

export { sequelize, User, Room };