# think-session2

> Session for ThinkJS

Latest version **1.0.2** (published 2018-12-27) · 0 weekly downloads

## Install

```sh
npm install think-session2
pnpm add think-session2
yarn add think-session2
bun add think-session2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-12-27 |
| First published | 2018-08-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | king-ui |

## Links

- npm: https://www.npmjs.com/package/think-session2
- Repository: https://github.com/hm496/think-session
- Homepage: https://github.com/hm496/think-session#readme
- Issues: https://github.com/hm496/think-session/issues
- npm.io page: https://npm.io/package/think-session2

## Dependencies (1)

- [think-helper](https://npm.io/package/think-helper.md) ^1.0.0

## Recent versions

- 1.0.2 (latest) — 2018-12-27
- 1.0.1 — 2018-08-18
- 1.0.0 — 2018-08-18

## README

# think-session
[![Build Status](https://img.shields.io/travis/thinkjs/think-session/master.svg?style=flat-square)](https://travis-ci.org/thinkjs/think-session)
[![Coverage Status](https://img.shields.io/coveralls/thinkjs/think-session/master.svg?style=flat-square)](https://coveralls.io/github/thinkjs/think-session?branch=master)
[![npm](https://img.shields.io/npm/v/think-session.svg?colorB=brightgreen&style=flat-square)](https://www.npmjs.com/package/think-session)


Session for ThinkJS 3.x.

Add `session` method for controller/context.

## config

config file `src/config/adapter.js`, add options:

```js
const cookie = require('think-session-cookie');
exports.session = {
  type: 'cookie',
  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.*

---
_Source: https://npm.io/package/think-session2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
