This tutorial shows how to use Upstash inside your NuxtJS application.
This tutorial uses Redis as state store for a Nuxt.js application. We simply increment a counter that pulls the data from Redis.
1
Create Nuxt.js ProjectRun this in terminal
2
Set up environment variablesCopy the .env.example
file in this directory to .env
REDIS_URL
: Copy the url in the database page of the Upstash consoleThis example uses ioredis, you can copy the connection string from the Node tab in the console.
3
Server MiddlewareWe will write a Nuxt middleware which increments a counter in Redis and returns its new value.
Now we will configure the middleware in nuxt.config.js
4
RunGo to http://localhost:3000/
This tutorial shows how to use Upstash inside your NuxtJS application.
This tutorial uses Redis as state store for a Nuxt.js application. We simply increment a counter that pulls the data from Redis.
1
Create Nuxt.js ProjectRun this in terminal
2
Set up environment variablesCopy the .env.example
file in this directory to .env
REDIS_URL
: Copy the url in the database page of the Upstash consoleThis example uses ioredis, you can copy the connection string from the Node tab in the console.
3
Server MiddlewareWe will write a Nuxt middleware which increments a counter in Redis and returns its new value.
Now we will configure the middleware in nuxt.config.js
4
RunGo to http://localhost:3000/