From f185156a30c9c40e5301b42c18fd0282459a6376 Mon Sep 17 00:00:00 2001 From: zeus Date: Tue, 24 Nov 2020 01:59:58 +0200 Subject: [PATCH] global --- swarmlab-app/src/run/app.js | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index 556e8a3..95b7d5b 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -267,11 +267,15 @@ app.post('/run', [ ], cors(corsOptions), (req, res, next) => { + + (async() => { + //console.log(JSON.stringify(req.headers)); //console.log(JSON.stringify(req.body)); console.log("mongo "+JSON.stringify(req.body)); console.log("LOG "+JSON.stringify(req.body[0].message)); console.log("PATH "+JSON.stringify(req.body[0].tailed_path)); + var getpath = await onlogfile(req.body[0].tailed_path) for (var i = 0; i < req.body.length; i++){ var obj = req.body[i]; @@ -282,17 +286,6 @@ cors(corsOptions), (req, res, next) => { var reslog = new Object(); reslog.log = obj - //reslog.test = usersession.SOCKET.user - //var n = {} - //n.year = now.getFullYear(); - //n.month = now.getMonth(); - //n.day = now.getDay(); - //n.hours = now.getHours(); - //n.minutes = now.getMinutes(); - //n.seconds = now.getSeconds(); - //n.milliseconds = now.getMilliseconds(); - //reslog.date = n - reslog.date = convertDateToUTC(now) console.log(reslog); var pathfileval = pathmodule.basename(reslog.log.tailed_path); @@ -304,16 +297,8 @@ cors(corsOptions), (req, res, next) => { console.log("IOTuser "+JSON.stringify(global.pipelines)); // io.in("iot").emit("message", reslog); // io.emit("logdata", reslog); -/* - for (var key in obj){ - var value = obj[key]; - //console.log("line " + key + ": " + value); - reslog.key = key - reslog.value = value - //io.emit("logdata", reslog); - } - */ } + })() //io.in("iot").emit("message", RES);