-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
45 lines (36 loc) · 1.16 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require("dotenv").config();
const express = require("express");
const connectDB = require("./config/connectDB");
const cors = require("cors");
const passport = require("passport");
const passportSetup = require("./config/passport-setup");
const discordAuth = require("./routes/discordAuth");
const facebookAuth = require("./routes/facebookAuth");
const localAuth = require("./routes/localAuth");
const fs = require("fs");
const morgan = require("morgan");
const ecsFormat = require("@elastic/ecs-morgan-format");
const app = express();
app.use(express.json());
app.use(cors());
app.use(require("cookie-parser")());
app.use(require("body-parser").urlencoded({ extended: true }));
app.use(passport.initialize());
app.use(passport.session());
app.use(
require("express-session")({
secret: "secret",
resave: true,
saveUninitialized: true,
})
);
// app.use(morgan( 'dev' ))
app.use(morgan(ecsFormat({ format: 'tiny' })))
app.use("/socialDiscord", discordAuth);
app.use("/socialFacebook", facebookAuth);
app.use("/local", localAuth);
const PORT = process.env.PORT || 3000;
connectDB();
app.listen(PORT, () => {
console.log(`Server listning on port ${PORT}`);
});