-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (32 loc) · 1.04 KB
/
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
const express = require('express');
const app = express();
const requestHandler = require('./util/requestHandler.js');
const port = 6042;
app.use(express.static('public'));
app.get('/', function (req, res) {
res.sendFile(__dirname + '/public/index.html');
});
app.get('/vms', function (req, res) {
res.sendFile(__dirname + '/public/vms-screen.html');
});
app.get('/qrcode', function (req, res) {
let state = req.headers.state;
var request = {
"domain": 'stg.spm.backend.leekimhr.com',
"port": 6041,
"requestPath": "/generateqrcode",
"headers": { 'state': state },
"method": "GET"
};
requestHandler.getHttpsResponse(request.domain, request.requestPath, request.headers, request.method, "")
.then(result => {
res.jsonp(result.msg);
})
.catch(error => {
console.log("\n--- Mock VMS Client Error---");
console.log(error);
console.log("--- Mock VMS Client Error---\n");
res.sendStatus(500);
});
});
app.listen(port, () => console.log(`Your VMS Client listening on port ${port}!`));