forked from samranjbari/interview-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
37 lines (31 loc) · 980 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
32
33
34
35
36
37
var express = require('express');
var session = require('express-session');
var mysql = require('mysql');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var passport = require('passport');
var flash = require('connect-flash');
var LocalStrategy = require('passport-local');
var app = express();
var port = process.env.PORT || 1337;
// Passport Configuration
require('./config/passport')(passport); // pass passport for configuration
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.set('view engine', 'jade');
// Passport Set Up
app.use(session({
secret: 'vidyapathaisalwaysrunning', // Ideally we would store this elsewhere..
resave: true,
saveUninitialized: true
} ));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
// Routing
require('./routes/index.js')(app, passport);
// Start App
app.listen(port);