forked from UMD-INST377/Sequelize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (27 loc) · 757 Bytes
/
server.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
32
33
34
35
import express from 'express';
import db from './database/initializeDB.js';
import apiRoutes from './routes/apiRoutes.js';
const app = express();
const PORT = process.env.PORT || 3000;
const staticFolder = 'public';
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(express.static(staticFolder));
app.use('/api', apiRoutes);
async function dining_hall(){
const req = await fetch("/api/dining");
const dining = await req.json();
console.log(dining)
}
async function bootServer() {
try {
const mysql = await db.sequelizeDB;
await mysql.sync();
app.listen(PORT, () => {
console.log(`Listening on: http//localhost:${PORT}`);
});
} catch (err) {
console.error(err);
}
}
bootServer();