-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (25 loc) · 967 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
const express = require('express');
const mongoose = require('mongoose');
const cookieSess = require('cookie-session');
const bodyParser = require('body-parser');
const passport = require('passport');
const keys = require('./config/keys');
require('./models/User') /* just want passport.js to be executed. Hence, need not assign this */
require('./services/passport'); /* We just want passport.js to be executed. Hence, need not assign this to a variable */
const authRoutes = require('./routes/authRoutes');
const billingRoutes = require('./routes/billingRoutes');
mongoose.connect(keys.mongoURI);
const app = express();
app.use(bodyParser.json());
app.use(
cookieSess({
maxAge: 30 * 24 * 60 * 60 * 1000,
keys: [keys.cookieEncryptionKey]
})
);
app.use(passport.initialize());
app.use(passport.session());
authRoutes(app);
billingRoutes(app);
const PORT = process.env.PORT || 5020
app.listen(PORT, console.log("Listenting @ PORT 5020"));