-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (30 loc) · 879 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 express = require("express");
const app = express();
const passport = require("passport");
const nunjucks = require("nunjucks");
const cookieSession = require("cookie-session");
const keys = require("./keys.json");
const fileuppload = require("express-fileupload");
const homeRouter = require("./routes/dashboard");
const authRouter = require("./routes/authentication");
app.use("/static", express.static("public"));
nunjucks.configure("views", {
autoescape: true,
express: app,
});
app.use(
cookieSession({
keys: [keys.session_key],
})
);
//passport
app.use(passport.initialize());
app.use(passport.session());
//upload
app.use(fileuppload());
//routes
app.use("/", homeRouter);
app.use("/authenticate", authRouter);
//general app stuff
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Server running on port ${port} 🔥`));