-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (30 loc) · 968 Bytes
/
index.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
const path = require("path");
const express = require("express");
const app = express();
const passport = require("passport");
const passportSetup = require("./src/config/passport_setup");
const cookieParser = require("cookie-parser");
const cookieSession = require("cookie-session");
const keys = require("./src/config/keys");
require("dotenv").config();
app.set("view engine", "ejs");
const PORT = process.env.PORT || 3000;
app.use("/", express.static(path.join(__dirname, "public")));
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use(cookieParser());
// set up session cookies
app.use(
cookieSession({
maxAge: 7 * 24 * 60 * 60 * 1000,
keys: [keys.session.cookieKey],
})
);
// initialize passport
app.use(passport.initialize());
app.use(passport.session());
app.use(require("./src/routes/index"));
//app.use(require("./src/seeds/index"));
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}`);
});