-
Notifications
You must be signed in to change notification settings - Fork 716
/
server.js
42 lines (35 loc) · 1.03 KB
/
server.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
var express = require('express')
var bodyParser = require('body-parser')
var passport = require('passport')
var session = require('express-session')
var ejs = require('ejs')
var morgan = require('morgan')
const fileUpload = require('express-fileupload');
var config = require('./config/server')
//Initialize Express
var app = express()
require('./core/passport')(passport)
app.use(express.static('public'))
app.set('view engine','ejs')
app.use(morgan('tiny'))
app.use(bodyParser.urlencoded({ extended: false }))
app.use(fileUpload());
// Enable for Reverse proxy support
// app.set('trust proxy', 1)
// Intialize Session
app.use(session({
secret: 'keyboard cat',
resave: true,
saveUninitialized: true,
cookie: { secure: false }
}))
// Initialize Passport
app.use(passport.initialize())
app.use(passport.session())
// Initialize express-flash
app.use(require('express-flash')());
// Routing
app.use('/app',require('./routes/app')())
app.use('/',require('./routes/main')(passport))
// Start Server
app.listen(config.port, config.listen)