How to update url nodejs when xml file change in javascript? -
the code works , wanted updated when xml changes , without using timeut or interval
app.get('/prove', function (req, res) { testxml("1"); res.end('ok \n'); }); testxml = function (num) { request({ uri:'urlxml', method: "get" }, function (err, res2, body) { ......
so question being asked here really: how make sure response sent after xml updates when xml updated in request?
one way of solving rewriting testxml function take callback function , calling res.end in that.
app.get('/prove', function (req, res) { testxml("1", function(){ res.end('ok \n'); }); }); testxml = function (num, callback) { request({ uri:'urlxml', method: "get" }, function (err, res2, body) { ... callback() }) }
Comments
Post a Comment