-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
51 lines (43 loc) · 1.6 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
45
46
47
48
49
50
51
const express = require("express");
const app = express();
const db = require('./models')
const exphbs = require("express-handlebars");
const session = require("express-session");
require('dotenv').config();
const PORT = process.env.PORT || 8080;
app.use(express.static("public"));
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.engine("handlebars", exphbs({ defaultLayout: "main" }));
app.set("view engine", "handlebars");
app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: true,
cookie: {
maxAge: 7200000
}
}))
// Routes for rendering and db interaction
const frontendRoutes = require("./controllers/frontend_controller");
app.use(frontendRoutes);
const authRoutes = require("./controllers/auth_controller");
app.use("/auth", authRoutes);
const userRoutes = require("./controllers/users_controller");
app.use(userRoutes);
const favRoutes = require("./controllers/favorites_controller");
app.use("/fav", favRoutes);
// Third Party API Routes for search results
const tastediveRoutes = require("./controllers/third_party_api/tastedive-api-routes");
app.use(tastediveRoutes);
const zomatoRoutes = require("./controllers/third_party_api/zomato-api-route");
app.use(zomatoRoutes);
const ticketmasterRoutes = require("./controllers/third_party_api/ticketmaster-api-route");
app.use(ticketmasterRoutes);
const recipepuppyRoutes = require("./controllers/third_party_api/recipepuppy-api-route");
app.use(recipepuppyRoutes);
db.sequelize.sync().then(function () {
app.listen(PORT, function () {
console.log("App now listening on port:", PORT);
});
});