-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
44 lines (33 loc) · 1.16 KB
/
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
36
37
38
39
40
41
42
43
44
const express = require("express");
const app = express();
const PORT = process.env.PORT || 8080;
const db = require("./app/models");
// Sets up the Express app to handle data parsing
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Static directory
app.use(express.static("app/public"));
// Routes
require("./app/routes/api-routes.js")(app);
// Starts the server to begin listening
// =============================================================
db.sequelize.sync().then(() => {
app.listen(PORT, function () {
console.log("App listening on PORT " + PORT);
});
});
// const express = require("express");
// const app = express();
// const PORT = process.env.PORT || 8080;
// // Sets up the Express app to handle data parsing
// app.use(express.urlencoded({ extended: true }));
// app.use(express.json());
// // Static directory
// app.use(express.static("app/public"));
// // Routes
// require("./app/routes/api-routes.js")(app);
// // Starts the server to begin listening
// // =============================================================
// app.listen(PORT, function () {
// console.log("App listening on PORT " + PORT);
// });