-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
39 lines (33 loc) · 1.01 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
const express = require('express');
const compression = require('compression');
const session = require('express-session');
const RedisStore = require('connect-redis')(session);
const redis = require('redis');
const flash = require('connect-flash');
const passport = require('passport');
const cookieParser = require('cookie-parser');
const router = require('./app/router.js');
const passportConfig = require('./config/passport.js');
let app = express();
app.use(session({
store: new RedisStore({ client: redis.createClient() }),
secret: 'learninghowtousepassporjsgoogle',
name: 'passport_google',
cookies: {
secure: false,
maxAge: 3600000,
},
saveUninitialized: false,
resave: false
}));
app.use(cookieParser());
app.use(compression());
app.use(flash());
app.use(passport.initialize());
app.use(passport.session());
app.set('view engine', 'ejs');
router(passport, app);
passportConfig(passport);
app.listen(3000, () => {
console.log('server running at http://localhost:3000/');
});