Guidance/ reference for building my cloudflare worker.

Hi all, this is my first time building a cloud flare worker. I am trying to build a middleware API on Cloudflare for an stock market API. I want to implement caching and cron job in this. I also want to use KV store. Can someone share code examples for something that has similar use cases? I view the structure and the architecture. Thank you for all the help!
1 Reply
Mackenly
Mackenly9mo ago
This example shows an API proxy: https://developers.cloudflare.com/workers/examples/fetch-json/ The docs for KV show several examples: https://developers.cloudflare.com/kv/ For KV just create a key store for each endpoint of the 3rd party API. Store responses with a TTL for how long you need the cache to last. And then when requests come in, check if the key exisits (if so return the value), if not get fresh data.