-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (37 loc) · 1.1 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
require("dotenv").config();
const express = require("express");
const app = express();
const connection = require("./api/config/db");
const cors = require("cors");
const path = require("path");
const passport = require("passport");
const session = require("express-session");
var cookieParser = require("cookie-parser");
// const fileUpload = require("express-fileupload");
// // default options
// app.use(fileUpload());
app.use(express.static(__dirname + '/public'));
// Passport Config
require("./api/config/passport")(passport);
// view engine setup
app.set("views", "views");
app.set("view engine", "ejs");
connection();
app.use(cookieParser());
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cors());
// Express session
app.use(
session({
secret: "secret",
resave: true,
saveUninitialized: true,
})
);
// Passport middleware
app.use(passport.initialize());
app.use(passport.session());
app.use("/", require("./api/routes/index"));
const port = process.env.PORT || 8080;
app.listen(port, () => console.log(`Listening on port ${port}...`));