1 Create Next.js Project
Run this in terminal
2 Create a Redis (Upstash) Database
- Create a database as getting started
3 Set up environment variables
Copy the .env.local.example file in this directory to .env.local
REDIS_URL: Copy the url in the database page Upstash console
This example uses ioredis, you can copy the connection string from the
Node tab in the console.
4 Run the app
Install dependencies packages
5 Live!
Go to http://localhost:3000/ 🎉
Notes:
- For best performance the application should run in the same region with the Redis database’s region.
- Alternatively, counter can be read from the APIs instead of getServerSideProps().