think-session-redis

Use redis to store session data

Usage no npm install needed!

<script type="module">
  import thinkSessionRedis from 'https://cdn.skypack.dev/think-session-redis';
</script>

README

think-session-redis

Use Redis to store session for ThinkJS

Build Status Coverage Status npm

Install

npm install think-session-redis

How to use

config file src/config/adapter.js, add options:

const redisSession = require('think-session-redis');
exports.session = {
  type: 'redis',
  common: {
    cookie: {
      name: 'thinkjs',
      //maxAge: '',
      //expires: '',
      path: '/',  //a string indicating the path of the cookie
      //domain: '',
      //secure: false,
      //keys: [],
      httpOnly: true,
      sameSite: false,
      signed: false,
      overwrite: false
    }
  },
  redis: {
    handle: redisSession,
    maxAge: 3600 * 1000, //session timeout, if not set, session will be persistent.
    autoUpdate: false, //update expired time when get session, default is false
  }
}