Awesome
think-session-redis
Use Redis to store session for ThinkJS
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
}
}