I have zero background in IT. I want to create a worker that caches an already existing API so users of my app (buddyboss app) have a faster and more user friendly experience. I’m lost as it pertains to using fetch when the API already exists (not sure if this is written in on the creation of the API) and how to cache the current API. Thanks for any help. (Apologies up front if this doesn’t make 100% sense.)
What’s the URL of a typical API call?
I can’t help but think most of your API calls will have different payloads, making it nearly impossible to cache.
This page has a link of all the APIs used within the buddyboss app.
BuddyBoss App REST API Being that it’s a social media site and very dynamic, I understand the difficult in caching some stuff (though I honestly don’t know what can or can’t be cached), but I would at least like to cache the framework of the app, and the stuff everyone sees, on cloudflare’s edge so it’s not hammering the server every time someone uses the app.
There is a really good example of the Cache API available here: https://developers.cloudflare.com/workers/examples/cache-api
You should just check the cache, if it doesn’t exist then
fetch the original request and store it in the cache.
If you need any additional help feel free to reply here or join the Discord (lots of members there who can help quickly!)
I’ve given this a long look over the last several days, and my knowledge gap is too wide to manipulate this myself, but thank you.
It does seem possible, but it seems very few people here talk about it. I still suspect that your users will send different payloads in their requests, making them mostly unique.