You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
815 B
38 lines
815 B
|
|
var app = require('express')();
|
|
var fs = require('fs');
|
|
|
|
const cors = require('cors')
|
|
const helmet = require('helmet');
|
|
//app.use(cors)
|
|
app.use(helmet());
|
|
|
|
var options = {
|
|
key: fs.readFileSync('./llo/swarmlab.key'),
|
|
cert: fs.readFileSync('./llo/swarmlab.crt')
|
|
};
|
|
var serverPort = 3000;
|
|
|
|
var https = require('https').Server(options, app);
|
|
//var server = https.createServer(options, app);
|
|
|
|
|
|
|
|
app.get('/run', (req, res, next) => {
|
|
console.log('hi');
|
|
|
|
(async() => {
|
|
|
|
var RES = new Object();
|
|
RES.code = req.query["action"]
|
|
RES.token = req.query["token"]
|
|
RES.error = false
|
|
RES.error_msg = "ok"
|
|
//res.json(RES)
|
|
res.send(RES)
|
|
})()
|
|
|
|
});
|
|
|
|
https.listen(3000, () => console.error('listening on http://localhost:3000/'));
|
|
console.error('socket.io example');
|
|
|