db.js 578 Bytes
Newer Older
1
import mysql from "mysql2/promise";
2
3
4
5
6
7
8
9
10
11
12
13
14
import dotenv from "dotenv";

dotenv.config();

// MySQL Config
const db_config = {
  host: process.env.MYSQL_HOST || "localhost",
  user: process.env.MYSQL_USER || "root",
  password: process.env.MYSQL_PASSWORD,
  database: process.env.MYSQL_DATABASE || "EUE",
  connectionLimit: 5,
};

15
16
// Creation of MySQL Pool, and Export
export const pool = mysql.createPool(db_config);
17

18
// Messages for Data Base.
19
20
export const dbMSG = {
  connection_err: "DB Connection Error.",
21
22
  query_success: "DB Query Success.",
  query_err: "DB Querry Error.",
23
};