1 Create Nuxt.js Project
Run this in terminal
nuxtjs-with-redis and install @upstash/redis:
2 Create a Upstash Redis database
Next, you will need an Upstash Redis database. You can follow
our guide for creating a new database.
3 Set up environment variables
Copy the .env.example file in this directory to .env
If you are using the Vercel & Upstash integration, you may use the following environment variables:
.env
4 Define the endpoint
Next, we will define the endpoint which will call Redis:
server/api/increment.ts
5 Run
Finally, we can run the application and call our endpoint:
Increment button to run the endpoint we defined.
Otherwise, you can simply make a curl request:
Notes:
- For best performance the application should run in the same region with the Redis database’s region.