-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (28 loc) · 831 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const express = require("express");
const path = require("path")
const mysql = require("mysql2");
const app = express();
const dotenv = require("dotenv").config();
const cookieParser = require("cookie-parser");
// app.use("/", express.static(path.join(__dirname, "./public")));
app.use(express.urlencoded({ extended: false }))
app.use(express.json());
app.use(cookieParser());
app.set('view engine', 'html');
const db = mysql.createConnection({
host: process.env.HOST,
user: process.env.DATABASE_USER,
password: process.env.PASSWORD,
database: process.env.DATABASE
});
db.connect((err) => {
if (err) {
console.log(err);
} else {
console.log("MYSQL CONNECTED")
}
})
// Define Routes
app.use('/', require('./routes/pages'));
app.use('/auth', require('./routes/auth'));
app.listen(5000)