-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
44 lines (32 loc) · 1.07 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
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const ejs = require("ejs");
const mongoose = require('mongoose');
const session = require('express-session');
const passport = require('passport');
// Routers
const indexRouter = require("./routes/index");
const authRouter = require("./routes/auth");
const queueRouter = require("./routes/queue");
const app = express();
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static("public"));
app.use(session({
secret: process.env.SECRET,
resave: false,
saveUninitialized: false
}));
app.use(passport.initialize());
app.use(passport.session());
mongoose.connect(process.env.DATABASE_URL, {useNewUrlParser: true, useUnifiedTopology: true});
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
// Using Routes
app.use("/", indexRouter);
app.use("/auth", authRouter);
app.use("/queue", queueRouter);
app.listen(process.env.PORT || 3000, () => {
console.log("Server is running on port 3000");
});