Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-session-file
File session for ThinkJS 3.x
https://github.com/thinkjs/think-session-file
file session think-adapter thinkjs
Last synced: about 1 month ago
JSON representation
File session for ThinkJS 3.x
- Host: GitHub
- URL: https://github.com/thinkjs/think-session-file
- Owner: thinkjs
- License: mit
- Created: 2016-08-02T01:31:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T23:56:26.000Z (over 3 years ago)
- Last Synced: 2024-09-29T16:05:32.475Z (2 months ago)
- Topics: file, session, think-adapter, thinkjs
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-session-file
README
# think-session-file
File session for ThinkJS
[![Build Status](https://img.shields.io/travis/thinkjs/think-session-file/master.svg?style=flat-square)](https://travis-ci.org/thinkjs/think-session-file)
[![Coverage Status](https://img.shields.io/coveralls/thinkjs/think-session-file/master.svg?style=flat-square)](https://coveralls.io/github/thinkjs/think-session-file?branch=master)
[![npm](https://img.shields.io/npm/v/think-session-file.svg?colorB=brightgreen&style=flat-square)](https://www.npmjs.com/package/think-session-file)## Install
```
npm install think-session-file
```## How to use
config file `src/config/adapter.js`, add options:
```js
const fileSession = require('think-session-file');
exports.session = {
type: 'file',
common: {
cookie: {
name: 'thinkjs',
//maxAge: '',
//expires: '',
path: '/', //a string indicating the path of the cookie
//domain: '',
//secure: false,
//keys: [],
httpOnly: true,
sameSite: false,
signed: false,
overwrite: false
}
},
file: {
handle: fileSession,
sessionPath: path.join(think.ROOT_PATH, 'runtime/session'), //file session store root path
maxAge: '1d', //session timeout, default is 1 day
autoUpdate: false, //update expires time when get session, default is false
}
}
```