jankleinert / redis-session-demo

Demo app that shows session management for a Node.js app using express-sessions and connect-redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redis-session-demo overview

Demo app that shows session management for a Node.js app using express-sessions and connect-redis. Originally created for Redis Day NYC 2019: https://events.redislabs.com/sessions/life-user-session/

The app queries an API for ML-generated craft beer names and displays them on the page. There is a session management panel that displays session ID, time until the session expires, and the number of beer names viewed in that session.

Learn more about how it works in this tutorial:

how to run

Make sure you have have Redis server running locally:

redis-server

Then clone this repo, run npm install and then run it in dev mode:

git clone https://github.com/jankleinert/redis-session-demo
cd redis-session-demo
npm install
export SESSION_SECRET=<some value you choose>
npm run dev

Then in your browser, go to http://localhost:3000. It should look something like this:

screenshot

how it works

This demo uses express-session for session management and connect-redis as the session store.

branches

The master branch contains the app with simple session management.

The auth branch will add in authentication using passport.js.

About

Demo app that shows session management for a Node.js app using express-sessions and connect-redis


Languages

Language:JavaScript 57.4%Language:CSS 24.0%Language:Pug 18.6%