Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Session: Redis

Install and Run

Download this example or clone bottender.

curl https://codeload.github.com/Yoctol/bottender/tar.gz/master | tar -xz --strip=2 bottender-master/examples/session-redis
cd session-redis
npm install
npm run dev

Idea of this example

This example shows how to use Session to store some information from users and store sessions in your Redis server. For more information, check our session guide.

Redis connection settings

RedisSessionStore use ioredis as underlying redis client, so you can use any method ioredis supports:

new RedisSessionStore()       // Connect to
new RedisSessionStore(6380)   //
new RedisSessionStore({
  port: 6379,          // Redis port
  host: '',   // Redis host
  family: 4,           // 4 (IPv4) or 6 (IPv6)
  password: 'auth',
  db: 0
// Connect to, db 4, using password "authpassword"
new RedisSessionStore('redis://:authpassword@')

Related examples