express4里要单独安装cookie-parser和express-session:
1
2
|
npm install express-session --save npm install cookie-parser --save |
有关代码替换成
1
2
3
4
5
6
7
|
var cookieParser = require( ‘cookie-parser‘ ) var session = require( ‘express-session‘ ) app.use(cookieParser()) app.use(session({ secret: ‘imooc‘ })) |
参考地址:
express4里要单独安装cookie-parser和express-session
原文:http://www.cnblogs.com/benpaodexiaopangzi/p/5940427.html