express 4.0 , express-session with odd warning message

前端 未结 4 1669
时光说笑
时光说笑 2020-12-07 21:56

I am trying to work through setting up a nodejs app using express 4.x. After stumbling through the middleware-removal issues, I finally got it working.

however, ther

相关标签:
4条回答
  • 2020-12-07 22:06

    I don't have enough rep to add this as comment. I added this for my default value of Ben's answer.

    secret: process.env.SESSION_SECRET || '<mysecret>',
    
    0 讨论(0)
  • 2020-12-07 22:24

    I found issue useful:

    https://github.com/expressjs/session/issues/56

    app.use(session({
        secret: cookie_secret,
        resave: true,
        saveUninitialized: true
    }));
    
    0 讨论(0)
  • 2020-12-07 22:27

    As the warnings say, the default values will change so they want to ensure that by setting the values explicitly now, you won't run into unexpected behavior when the defaults do change (in the near future).

    0 讨论(0)
  • 2020-12-07 22:30
    app.use(session({
      cookieName: 'session',
      secret: 'eg[isfd-8yF9-7w2315df{}+Ijsli;;to8',
      duration: 30 * 60 * 1000,
      activeDuration: 5 * 60 * 1000,
      httpOnly: true,
      secure: true,
      ephemeral: true,
      resave: true,
      saveUninitialized: true
    }));
    
    0 讨论(0)
提交回复
热议问题