Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-session-cookie
Use cookie to store session for ThinkJS 3.x
https://github.com/thinkjs/think-session-cookie
cookie session think-adapter thinkjs3
Last synced: about 1 month ago
JSON representation
Use cookie to store session for ThinkJS 3.x
- Host: GitHub
- URL: https://github.com/thinkjs/think-session-cookie
- Owner: thinkjs
- License: mit
- Created: 2017-03-19T08:38:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-23T07:55:45.000Z (almost 5 years ago)
- Last Synced: 2024-10-13T15:48:34.436Z (2 months ago)
- Topics: cookie, session, think-adapter, thinkjs3
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 10
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-session-cookie
README
# think-session-cookie
[![Build Status](https://travis-ci.org/thinkjs/think-session-cookie.svg?branch=master)](https://travis-ci.org/thinkjs/think-session-cookie)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-session-cookie/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-session-cookie?branch=master)
[![npm](https://img.shields.io/npm/v/think-session-cookie.svg?style=flat-square)](https://www.npmjs.com/package/think-session-cookie)Use cookie to store session
## Install
```
npm install think-session-cookie
```## How to use
config file `src/config/adapter.js`, add options:
```js
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
}
}
}
```