modified to use events, hopefully will fix the crashing particle
This commit is contained in:
parent
b088fb3332
commit
b3477fb9f9
@ -123,10 +123,26 @@ router.post('/', function (req, res, next) {
|
||||
|
||||
var t = req.body;
|
||||
var now = new Date();
|
||||
var dataJSON={};
|
||||
console.log('~~~~');
|
||||
if(t.hasOwnProperty(data)){
|
||||
var data = t.data;
|
||||
dataJSON = JSON.parse(data);
|
||||
if(t.hasOwnProperty(temp)) {
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error('No temp data!');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error('No data block!');
|
||||
}
|
||||
console.log(JSON.stringify(t));
|
||||
if (t != {} && t.temp != null) {
|
||||
busEmitter.emit("saveTempData", {time: now.toJSON(), value: parseFloat(t.temp)});
|
||||
if (dataJSON != {} && dataJSON.temp != null) {
|
||||
busEmitter.emit("saveTempData", {time: now.toJSON(), value: parseFloat(dataJSON.temp)});
|
||||
}
|
||||
|
||||
res.writeHead(200, {"ContentType": "text/html"});
|
||||
|
Loading…
Reference in New Issue
Block a user