I have an express server server where I need to fetch new collection from firebase that is of formate data-${date}
. How can I use node schedule (or anyother method) to accomplish this task .
Code is mainly of format
let date=new Date();
app.get("/fetch",(req,res) => {
// fetch data from firestore db `data-${date}`
}
tldr: date variable needs to be updated every midnight
2
Answers
node scheduler like many other schedulers are based on cronJobs.
So you need to define a cronSettings
You seem to use an express endpoint this is ok if you want also to trigger manually .
hope it helps
Balint
You can update date every midnight in node js express server to fetch from new collection