This tutorial shows how to use Serverless Redis as your session storage for your Express Applications.
See the Github repo.
Create a folder for your project and run: npm init
In your project folder run: npm install express redis connect-redis express-session
Create a database as described here.
In Upstash console, click the Connect
button, copy the connection code (Node.js node-redis). Create index.js file as below and replace the Redis connection part.
var express = require('express') var parseurl = require('parseurl') var session = require('express-session') const redis = require('redis') var RedisStore = require('connect-redis')(session) var client = redis.createClient ({ // REPLACE HERE })…
In this tutorial we will write a single page application which uses Redis as state store in a Next.js application.
The example is a basic roadmap voting application where users enter and vote for feature requests. You can check the complete application in Upstash Roadmap page
You can check the source code of the complete application here. Thanks to Upstash&Vercel integration, you can deploy the application yourself with zero cost and code by clicking Deploy with Vercel.
We will use Next.js as web framework. So let’s create a next.js app and install the redis client first.
npx create-next-app nextjs-with-redis
npm…
This tutorial shows how to build a serverless API for Page View Counter with Python and Redis. The API will the count page views and show it in JSON format.
Run the sam init and then
This tutorial shows you how to build a serverless API with Golang and Redis. The API will simply the count page views and show it in JSON format.
Run the `sam init` and then
In this tutorial I will showcase Redis as the state store for a Next.js application. We simply add a counter that pulls the data from Redis.
npx create-next-app nextjs-with-redis
npm install ioredis
index.js
as below (replace YOUR_REDIS_ENDPOINT
):import Head from 'next/head' import styles from '../styles/Home.module.css' import Redis from 'ioredis' export default function Home({ data }) { return ( <div className={styles.container}> <Head> <title>Create Next App</title> <link rel="icon" href="/favicon.ico" /> </Head> <main className={styles.main}> <h1 className={styles.title}> Welcome…
DevRel @upstash