-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (26 loc) · 1.05 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
const express = require('express');
const bodyParser = require('body-parser');
const passport = require('passport');
const GitHubStrategy = require('passport-github');
const morgan = require('morgan');
const session = require('express-session');
const mongoose = require('mongoose');
const routes = require('./main/routes.js');
const passportConfig = require('./main/passport.js');
//const config = require('./config.js');
const app = express();
var options = { server: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
replset: { socketOptions: { keepAlive: 300000, connectTimeoutMS : 30000 } } };
var url = process.env.MONGODBURL;
mongoose.connect(url, options);
passportConfig(passport);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(morgan('dev'));
app.use(express.static(__dirname + '/views'));
app.set('view engine', 'ejs');
app.use(session({ secret: 'hackbu' }));
app.use(passport.initialize());
app.use(passport.session());
routes(app, passport);
app.listen(process.env.PORT || 8080);