Checking if something changed with node-fetch

Hello, I am trying to make a thing where every minute node-fetch would do what I want, I already have that whole thing in place but, how would I make it so it would detect if something has changed because I don’t want it to send the same thing if nothing has changed… Also, how would I make the code wait so it isn’t constantly running? Can anybody help?

Can you explain what sort of trigger you want? For example, a local file has changed content, or you press a button on a web page?

Possibly you’re thinking of a listener which triggers code events? Like in hello-express, the default node express glitch project?

You might be interested in setInterval, Timers | Node.js v12.22.12 Documentation

Every minute the function would go through again, that’s the trigger.

What sort of condition to be detected?

Node-Fetch will fetch a link and if the data is changed I want it to send a message but if it isn’t changed then it will do nothing.

To keep the app awake for its polling via node-fetch, on Glitch you’d need it to be a boosted (paid) app, see https://glitch.com/pricing

Suggested app ingredients:

After the app has connected to its database, setup a timer with setTimer to do the fetch and comparison and messaging.

1 Like