-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.js
29 lines (25 loc) · 848 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
const express = require('express');
const app = express();
const PORT = process.env.PORT || 8080;
const passport = require('./passportAuthentication');
const authenticationRoute = require('./routes/authentication');
const apiRoutes = require('./routes/apiRoutes');
const htmlRoutes = require('./routes/htmlRoutes');
const cookieSession = require('cookie-session');
const log = console.log;
app.use(express.static('public'));
app.use(express.urlencoded({
extended: false
}));
app.use(express.json());
app.use(cookieSession({
maxAge: 24 * 60 * 60 * 1000, // one day in miliseconds
name: 'session',
keys: ['key1', 'key2']
}));
app.use(passport.initialize());
app.use(passport.session());
app.use('/', authenticationRoute);
app.use('/', apiRoutes);
app.use('/', htmlRoutes);
app.listen(PORT, () => log('Server is starting ', PORT));