Next.js Discord

Discord Forum

Cache data from a serverless function and serve it through another API endpoint

Unanswered
Holland Lop posted this in #help-forum
Open in Discord
Holland LopOP
Hi all, I have an API endpoint called updateValues running as a CRON job at /api/update/updateValues.js with the interval at 5 minute . Its only function is to perform certain mathematics and generate a bigint value.

I am trying to find a way to cache the value generated by the above mentioned API endpoint and serve it through another endpoint say /api/get/getLatest.js .

Does nextjs have a dedicated function for this very thing or I am supposed to use something like node-fetch?

Anything help, thanks a lot for your time : )

2 Replies

Holland LopOP
It does implement something similar but not what I am looking for, thanks @Ray. Will see if I can tailor this to what I want : )