Ok so what i'm planning do is: i want to fetch the json file from a server like an api, then search for changes since the last fetch and show me the changes.
So like: Fetch the json -> look for changes -> show me the changes
The json i like to fetch updates everyday a few times so i want that my output is up to date. It would be awesome if i can just fetch everytime the json updates like with js.watchfile.
So i tried to fetch the json that works. Also tried to loop the fetch and show me the response that also works
but i cant figured out how to look for the changes if the file is online
const fetch = require("node-fetch");
var url = 'https://example.com/jsondata'
function getDATA(resp){
fetch(url)
.then(function(data){
return data.json();
})
.then(function(parsed){
resp(parsed);
}).catch(function(error){
console.log('The error', error)
})
}
function loop() {
getDATA(function(resp){
console.log(resp)
})
}
setInterval(loop, 5000);