Home

Awesome

think-session-cookie

Build Status Coverage Status npm

Use cookie to store session

Install

npm install think-session-cookie

How to use

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

const cookie = require('think-session-cookie');
exports.session = {
  type: 'cookie',
  common: {
    cookie: {
      name: 'thinkjs',
      autoUpdate: false, //auto update cookie when maxAge is set
      //maxAge: '',
      //expires: '',
      path: '/',  //a string indicating the path of the cookie
      //domain: '',
      //secure: false,
      //keys: [],
      httpOnly: true,
      sameSite: false,
      signed: false,
      overwrite: false
    }
  },
  cookie: {
    handle: cookie,
    cookie: {
      encrypt: false //encrypt cookie data
    }
  }
}