`
start_p
  • 浏览: 66430 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

express-session启动警告deprecated undefined resave option

阅读更多

express-session deprecated undefined resave option; provide resave option at app.js:29:9

 express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at app.js:29:9

 

resave - forces session to be saved even when unmodified. (default: true)

resave ——重新保存:强制会话保存即使是未修改的。(默认值ture)

 

saveUninitialized - forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified. This is useful for implementing login sessions, reducing server storage usage, or complying with laws that require permission before setting a cookie. (default: true)

saveUninitialized——强制“未初始化”的会话保存到存储。一个会话未初始化的时候是新的,但不能修改。这对于实现登陆会话很有用,减少服务器存储的使用,或者服从一种在设置cookie之间的请求规则。。(默认值是true)

用有道翻译的真是晦涩难懂,我的理解是resave:假设每次登陆,就算会话存在也重新保存一次。

saveUninitialized :强制保存未初始化的会话到存储器

 

 

分享到:
评论
2 楼 start_p 2015-03-20  
resave改为ture就行啊
1 楼 IT人_ 2015-03-17  
解决该警告提示的方法竟然没写。。。。。

dbOptions={
cookieSecret: 'test',
dbName: 'testDb',
url:'mongodb://localhost/testDb'
}
app.use(session({
    resave: false,
    saveUninitialized: true,
    cookie: {maxAge:3600000},
    secret: dbOptions.cookieSecret,
    store: new mongoStore({
        db: dbOptions.dbName,
        url: dbOptions.url
    })
}));

相关推荐

Global site tag (gtag.js) - Google Analytics