Hi,
I´m using httpAdmin.get to send a json from the runtime js to the html. The problem I have is that the json is only updated the first time the code runs. I can see in the console that data variable is being updated, but when I see the json (opening the url with Chrome), the information is not being updated. It is refreshed only the first time after restarting Node-Red.
I think that maybe the res.json() is not able to over-write the existing json, but I don't know what to use instead.
Can anyone please help me?
mycostumnode.js:
node.updateEquipmentList = setInterval( async function () {
var data={};
if (typeof node.server !== 'undefined' && node.server && typeof node.server.getEquipmentsModel === 'function'){
data = await node.server.getEquipmentsModel();
RED.httpAdmin.get("/equipments/:id", RED.auth.needsPermission('TimeSeries.read'), function(req,res) {
res.json(data);
});
console.log(JSON.stringify(data));
}
}, 10000);