This tutorial showcases using Redis with REST API in Cloudflare Workers.
wrangler init
Choose yes
to create package.json, no
to typescript and yes
to create a
worker in src/index.js.
It will create wrangler.toml
, package.json
and src/index.js
.
Append the Upstash REST URL and token to the toml as below:
npm install @upstash/redis
Replace src/index.js
with the following:
wrangler dev
and open your browser at
localhost:8787.
wrangler publish
The url of your app will be logged:
https://using-cloudflare-workers.upstash.workers.dev/