Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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, there was a couple of warning messages in the following line of code :

app.use(session({secret: '<mysecret>'})

these warnings were :

Sun, 29 Jun 2014 12:45:10 GMT express-session deprecated pass resave option; default value will change at libconfigexpress.js:55:11

Sun, 29 Jun 2014 12:45:10 GMT express-session deprecated pass saveUninitialized option; default value will change at libconfigexpress.js:55:11

in the documentation, the default values for resave and saveUninitialized are true.

so, changing the code to read

app.use(session({secret: '<mysecret>', 
                 saveUninitialized: true,
                 resave: true}));

got rid of the warnings.

So, to get to the point of the question:

why should I have to pass these values in if they are the default values, and why don't I have to pass in the other options ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
407 views
Welcome To Ask or Share your Answers For Others

1 Answer

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...