think-session2
v1.0.2
Published
Session for ThinkJS
Downloads
5
Readme
think-session
Session for ThinkJS 3.x.
Add session
method for controller/context.
config
config file src/config/adapter.js
, add options:
const cookie = require('think-session-cookie');
exports.session = {
type: 'cookie',
cookie: {
handle: cookie
}
}
session method
this.session()
get all session datathis.session(name)
get session data with namethis.session(name, value)
set session datathis.session(null)
delete all session datathis.session(name, undefined, options)
get session data with options
For each ctx
, session is only instantiated once.