Home > OS >  How can i run script in firebase automatically
How can i run script in firebase automatically

Time:02-12

Hi I make App and I want delete story automatically after 24hour I can make it but user should open app to check Now how can i check from firebase server without open app(i think it something like run script in server without stop) I use firebase realtime database

CodePudding user response:

you could make use of firebase's cloud functions

Schedule Functions on an interval to delete a story

exports.scheduledFunction = functions.pubsub.schedule('every 5 
minutes').onRun((context) => {
  // your code to delete something
  console.log('This will be run every 5 minutes!');
  return null;
});

ref to scheduling cloud functions: https://firebase.google.com/docs/functions/schedule-functions

  • Related