forked from toheebster/nowServing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (24 loc) · 838 Bytes
/
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
var express = require('express'),
app = express(),
port = process.env.PORT || 8080,
mongoose = require('mongoose'),
passport = require('passport'),
morgan = require('morgan'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
session = require('express-session'),
configDB = require('./config/database.js');
flash = require('connect-flash');
app.use(flash());
mongoose.connect(configDB.url); // db connection
require('./config/passport')(passport);
app.use(morgan('dev'));
app.use(cookieParser());
app.use(bodyParser());
app.use(session({ secret: 'passport demo' }));
app.use(express.static(__dirname + '/frontend/public'));
app.use(passport.initialize());
app.use(passport.session());
require('./app/routes.js')(app, passport);
app.listen(port);
console.log('Server running on port ' + port);