-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommonController.js
More file actions
36 lines (29 loc) · 1011 Bytes
/
Copy pathCommonController.js
File metadata and controls
36 lines (29 loc) · 1011 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
36
var fs = require('fs');
var config = require('./config');
module.exports = function(app) {
app.get('/', function(req, res){
//var hostname = req.protocol+'://'+ req.headers.host;
var greet2 = fs.readFile(__dirname + '/index.html', 'utf8', function(err, data) {
//res.send(data.replace('{HOST_NAME}', hostname));
res.send(data);
});
});
app.get('/config', function(req, res){
if(req.query.auth == 1 )
{
config.setByPassAuth(false);
}
if(req.query.auth == 0 )
{
config.setByPassAuth(true);
}
if(req.query.jwt_exp > 1 )
{
let jwtExpTime = Number.parseInt(req.query.jwt_exp);
config.setJwtExpTime(jwtExpTime);
}
res.send({ authRequired:!config.isByPassAuth(),
jwtExpiresInSeconds:config.getJwtExpTime()
});
});
}