/**
 * Module   : taste-cookie-parser
 * Function : 学习cookie-parser使用方法
 * Project  : node-taste
 * License  : Copyright © 2017 Shanghai Zhenhua Heavy Industries Co., Ltd. All rights reserved
 * Author   : Created by Colin Wu on 2017/5/30.
 */

/**
 * module dependencies
 * @private
 */
var connect = require('connect')
var cookieParser = require('cookie-parser')
var signature = require('cookie-signature');

connect()
  .use(function(req, res, next){
    res.setHeader('Set-Cookie', ['foo = s:'+signature.sign('bar', 'nihao')])
    next()
  })
  .use(cookieParser('nihao'))
  .use(function hello(req, res){
    console.log('Cookies: ', req.cookies)
    console.log('Signed Cookies: ', req.signedCookies)
    res.end()
  })
  .listen(3000)


@@ -405,9 +405,31 @@
 re')
-;
+%0A%0Asecret = 'yueyingxie'
 %0A%0Aco
@@ -451,16 +451,17 @@
 function
+ 
 (req, re
@@ -468,16 +468,17 @@
 s, next)
+ 
 %7B%0A    re
@@ -508,19 +508,29 @@
 ', %5B
-'foo
+%0A      'user
  = s:'
-+
+ + 
 sign
@@ -545,22 +545,77 @@
 gn('
-bar', 'nihao')
+yue', secret),%0A      'age = s:' + signature.sign('yue', secret),%0A    
 %5D)%0A 
@@ -653,15 +653,14 @@
 ser(
-'nihao'
+secret
 ))%0A 
@@ -679,16 +679,17 @@
 on hello
+ 
 (req, re
@@ -690,16 +690,17 @@
 eq, res)
+ 
 %7B%0A    co
@@ -771,19 +771,28 @@
 ies: ', 
-req
+cookieParser
 .signedC
@@ -792,25 +792,85 @@
 signedCookie
-s
+('s:yue.0tMA6mtW0lNe76R8PbnQpL+G8yLqqB3lI1dOsAkhcbQ', secret)
 )%0A    res.en

update cookie-parser学习