forked from Nilay7/Authentication_Passport
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (28 loc) · 993 Bytes
/
index.js
File metadata and controls
36 lines (28 loc) · 993 Bytes
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
const path = require('path');
const express = require('express');
var session = require('express-session');
const app = express();
var port = process.env.PORT || 4000;
const passport = require('passport');
// const LocalStrategy = require('passport-local').Strategy;
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
// const flash = require('connect-flash');
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost:27017/passport-test');
app.use(bodyParser.urlencoded({ extended: false}));
app.use(bodyParser.json());
require('./config/passport.js')(passport);
// app.use(express.static(path.join(__dirname, 'public')));
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true,
cookie: { secure:true }
}));
app.use(passport.initialize());
// app.use(flash());
require('./routes/route.js')(app, passport);
app.listen(port, () => {
console.log('Server is up and running on port ' + port);
});