Hi, basic question (but on stackoverflow answers were quite complicated)
Can I cache on cloudflare CDN my JSON API responses?
E.g user requests my-website.com/api/blog/article-235346456 (behind that sits an express cloud function that routes the request and pulls the data from my firestore database) which returns the data of that article 235346456 in .JSON as a response. Since it doesn’t change often I don’t want to use my database unnecessary (i get charged at firestore for reads). So I want to cache that with Cloudflare CDN. If user changes something in the article, I just purge the cloudflare cache.
Is that possible? I think yes. I also found a tutorial How I used Cloudflare to reduce API response time to
But I just want to make sure it’s true. So I asked here
I know that it takes some seconds until CDN is purged & refreshed everywhere. But I don’t care since I don’t need that luxus in my app. If I would need that I’d use the Workers KV (which is quite expensive, but it’s a luxus so it of course has its justified cost)
Thanks a lot & kind regards