-
Notifications
You must be signed in to change notification settings - Fork 8
/
app.js
43 lines (33 loc) · 1001 Bytes
/
app.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
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, mobconf = require('./routes/mobileconfig')
, http = require('http')
, path = require('path');
var cookieParser = require('cookie-parser')
const helmet = require("helmet");
var app = express();
// all environments
app.set('port', process.env.PORT || 3001);
app.set('views', __dirname + '/views');
app.set('view engine', 'pug');
app.use(cookieParser(process.env.COOKIE_KEY || 'f76210bc2acc4f54af5754e15b0aab05'));
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.raw({
'type' : 'application/pkcs7-signature'
}))
app.use(helmet({
hsts : {
preload: true,
maxAge: 31536000,
includeSubDomains: true
}
}))
app.get('/', routes.index);
app.post('/enroll', mobconf.enroll);
app.get('/enrollment', mobconf.enrollment);
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});