-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
50 lines (40 loc) · 1.24 KB
/
index.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
40
41
42
43
44
45
46
47
48
49
50
/**
* Finger Farm...
* ... by Jon Roig / https://jonroig.com
*
*
*/
const express = require('express');
const exphbs = require('express-handlebars');
const cookieSession = require('cookie-session');
var passport = require('passport');
const app = express();
const config = require('./config').config;
const fingerServer = require('./lib/fingerserver');
const authenticationRoute = require('./routes/authentication');
const apiRoutes = require('./routes/apiRoutes');
const htmlRoutes = require('./routes/htmlRoutes');
app.engine('handlebars', exphbs());
app.set('view engine', 'handlebars');
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(config.webServer.httpPort, (err) => {
if (err) {
console.log(`Could not start http server on port ${config.webServer.httpPort}`);
return;
}
console.log(`HTTP server started on port ${config.webServer.httpPort}`);
});