think-session
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

think-session

Build Status Coverage Status npm

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',
  common: {
    maxAge: 24 * 3600 * 1000, // 1 day 
  },
  cookie: {
    handle: cookie
  }
}

session method

  • this.session() get all session data
  • this.session(name) get session data with name
  • this.session(name, value) set session data
  • this.session(null) delete all session data
  • this.session(name, undefined, options) get session data with options

For each ctx, session is only instantiated once.

Readme

Keywords

none

Package Sidebar

Install

npm i think-session

Weekly Downloads

88

Version

1.1.6

License

none

Unpacked Size

19.5 kB

Total Files

9

Last publish

Collaborators

  • lizheming
  • welefen
  • sijiecai
  • lushijie
  • berwin
  • bezos
  • toxicjohann
  • huangxiaolu