think_cookie

2.0.2 • Public • Published

介绍


npm version Dependency Status

Middleware Cookie for ThinkKoa.

安装


npm i think_cookie

使用


1、项目中增加中间件 middleware/cookie.js

module.exports = require('think_cookie');

2、项目中间件配置 config/middleware.js:

config: { //中间件配置
    ...,
    cookie: {
        domain: '',  // cookie所在的域名
        path: '/',       // cookie所在的路径
        // maxAge: -1, // cookie有效时长
        httpOnly: true,  // 是否只用于http请求中获取
        overwrite: false,  // 是否允许重写
        //expires: new Date('2017-02-15')  // cookie失效时间
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i think_cookie

Weekly Downloads

1

Version

2.0.2

License

MIT

Last publish

Collaborators

  • richenlin