-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (22 loc) · 875 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
require("dotenv").config();
require("./config/oauth");
require("./config/db");
const passport = require("passport");
const express = require("express");
const { authRouter } = require("./routes/auth");
const { feedbackRouter } = require("./routes/feedback");
const { cookieSession } = require("./middleware/cookie-session");
const { authGuard } = require("./middleware/auth-guard");
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieSession);
app.use(passport.initialize());
app.use(passport.session());
app.use("/auth", authRouter);
app.use(authGuard);
app.use(express.static(__dirname + "/views"));
app.use("/feedback", feedbackRouter);
app.use((req, res, next) => res.redirect("/algorithms.html"));
const port = process.env.PORT || 3000;
app.listen(port, () => console.log(`running on port ${port}`));