thinkjs / think-session-cookie

Use cookie to store session for ThinkJS 3.x

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
    }
  }
}

About

Use cookie to store session for ThinkJS 3.x

License:MIT License


Languages

Language:JavaScript 100.0%