Redis database setup
Create a Redis database using the Upstash Console or Upstash CLI. Select theGlobal type to minimize the latency from all edge locations. Copy
the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN for the next steps.
You’ll find them in the Connect section of your database. Select the REST tab and use the copy buttons.
Create a supabase/functions/upstash-redis-counter/.env file in your project
with the values you copied:
supabase/functions/upstash-redis-counter/.env
Code
Make sure you have the latest version of the Supabase CLI installed. Create a new function in your project:index.ts file:
index.ts