基于 Koa平台Node.js开发的KoaHub.js获取/设置会话功能代码
koa-session2
Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb with Babel
koa-session2
Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb with Babel
If you are not using babel in your projects, maybe you can try this version without babel.
Install
Usage
Custom Stores
Store.js
main.js
Options
Most options based on cookies
key
: a string for store session id in cookiestore
: a class for custom store (extend {Store}, func: #get(sid), #set(session, opts), #destory(sid))maxAge
: a number representing the milliseconds fromDate.now()
for expiryexpires
: aDate
object indicating the cookie's expiration date (expires at the end of session by default).path
: a string indicating the path of the cookie (/
by default).domain
: a string indicating the domain of the cookie (no default).secure
: a boolean indicating whether the cookie is only to be sent over HTTPS (false
by default for HTTP,true
by default for HTTPS).httpOnly
: a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true
by default).signed
: a boolean indicating whether the cookie is to be signed (false
by default). If this is true, another cookie of the same name with the.sig
suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of cookie-name=cookie-value against the first Keygrip key. This signature key is used to detect tampering the next time a cookie is received.overwrite
: a boolean indicating whether to overwrite previously set cookies of the same name (false
by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.
License
MIT
KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架
基于 Koa平台Node.js开发的KoaHub.js获取/设置会话功能代码的更多相关文章
- 基于 Koa平台Node.js开发的KoaHub.js的控制器,模型,帮助方法自动加载
koahub-loader koahub-loader是基于 Koa平台Node.js开发的KoaHub.js的koahub-loader控制器,模型,帮助方法自动加载 koahub loader I ...
- 基于 Koa平台Node.js开发的KoaHub.js连接打印机的代码
最近好多小伙伴都在做微信商城的项目,那就给大家分享一个基于 Koa.js 平台的 Node.js web 开发的框架连接微信易联云打印机接口的代码,供大家学习.koahub-yilianyun 微信易 ...
- 基于 Koa平台Node.js开发的KoaHub.js的静态服务器重写和索引代码
koa-static-server Static file serving middleware for koa with directory, rewrite and index support k ...
- 基于 Koa平台Node.js开发的KoaHub.js的模板引擎代码
koahub-handlebars koahub-handlebars koahub handlebars templates Installation $ npm install koahub-ha ...
- 基于 Koa平台Node.js开发的KoaHub.js的输出json到页面代码
koahub-body-res koahub body res Format koa's respond json. Installation $ npm install koahub-body-re ...
- 基于 Koa平台Node.js开发的KoaHub.js的跳过组件代码
koahub-skip koahub skip middleware koahub skip Conditionally skip a middleware when a condition is m ...
- 基于LBS平台的iOS开发
LBS,即Location Based Services,基于位置服务,用于定位.导航等功能,比如地图应用.订外卖等的app就需要这个功能. 在这里我使用的是高德LBS开放平台,地址:http://l ...
- 基于CkEditor实现.net在线开发之路(2)编写C#代码,怎么调用它。
上一章简约的介绍了CkEditor编辑器,可以编辑js逻辑代码,css,html,C#代码,这章我根据实际例子,讲解怎么编写C#代码和怎么调用它. 大家都还记得刚刚接触程序编时的hello Word吧 ...
- 手机开发必备技巧:javascript及CSS功能代码分享
1. viewport: 也就是可视区域.对于桌面浏览器,我们都很清楚viewport是什么,就是出去了所有工具栏.状态栏.滚动条等等之后用于看网页的区域,这是真正有效的区域.由于移动设备屏幕宽度不同 ...
随机推荐
- 基于ASIO的协程与网络编程
协程 协程,即协作式程序,其思想是,一系列互相依赖的协程间依次使用CPU,每次只有一个协程工作,而其他协程处于休眠状态.协程可以在运行期间的某个点上暂停执行,并在恢复运行时从暂停的点上继续执行. 协程 ...
- Word常用实用知识2
纯手打,可能有错别字,使用的版本是office Word 2013 转载请注明出处 http://www.cnblogs.com/hnnydxgjj/p/6296863.html,谢谢. 批注和 ...
- JUC学习笔记--JUC中并发工具类
JUC中并发工具类 CountDownLatch CountDownLatch是我目前使用比较多的类,CountDownLatch初始化时会给定一个计数,然后每次调用countDown() 计数减1, ...
- IOS开发,遇到的第一个bug
经过几天的得瑟,今天终于开始实践IOS开发了.由于没有苹果的电脑,现在先用虚拟机凑合着. 第一个开发的东西就是苹果官方向导里的helloworld了.最后在运行的时候有一个异常,导致程序会闪退,错误信 ...
- 【puthon基础】之str类字符串
str类字符串是不可变对象 1.创建字符串 s1 = str() #创建一个空字符串 s2 = str("hello") #创建字符串"hello" 2.处理字 ...
- 在Windows 10 Anniversary下配置Caffe
去年十月份的时候尝试过配置caffe,真的是恶心到家,当时用的还是微软魔改的基于NuGet的caffe.现在这个项目退役了,接手的是原项目下的windows分支,虽然并不是很成熟,但是依然非常推荐在W ...
- ubuntu14.04下手动安装eclipse
ubuntu14.04下手动安装eclipse 第一步: 安装jdk 第二步: 下载eclipse,假设下载的文件文件名为eclipse.tar.gz 第三步: 解压 sudo -zxvf ./ecl ...
- requireJS的初步掌握(二)
前面我们讲述了requireJS的一些认知和优点,==>http://www.cnblogs.com/wymbk/p/6366113.html 这章我们主要描述的是requireJS的一些常用的 ...
- 初探Lambda表达式/Java多核编程【1】从集合到流
从集合到流 接上一小节初探Lambda表达式/Java多核编程[0]从外部迭代到内部迭代,本小节将着手使用"流"这一概念进行"迭代"操作. 首先何为" ...
- MongoDB学习总结(六) —— 数据库备份和恢复
我们都知道数据库数据经常备份是多么的重要,MongoDB作为一个数据库系统,自然提供了完善,丰富而且好用的备份与恢复机制. 以下介绍三种数据库备份和恢复的方式 > 数据目录直接拷贝 数据库目录直 ...