This is cloudflare worker based API that acts like proxy for openexchangerates api, that:
- caches
/history
response for queried date into Cloudflare KV (you can easily tweak caching frequency by editing date format — by default it is one response per day) - allows to change base currency
Example request:
/?date=YYYY-MM-DD&base=UAH
- Install dependencies with
pnpm i
- Add your
OPENEXCHANGERATES_APP_ID
to.dev.vars
- Add
wrangler.toml
and fill it like shown inwrangler.toml.example
Disable local mode if you want to put values into _preview
KV
- Run
pnpm wrangler secret put
to addOPENEXCHANGERATES_APP_ID
with your openexchangerates App ID - Add
wrangler.toml
and fill it like shown inwrangler.toml.example
Then run pnpm run deploy
to publish changes