javascript – Node JS session error: express-session deprecated

javascript – Node JS session error: express-session deprecated

From express 4.0 , express-session with odd warning message

n

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

n

app.use(session({n    secret: cookie_secret,n    resave: true,n    saveUninitialized: truen}));n

You have to define the genuuid function somewhere. The express-session readme is assuming you have already implemented that.

n

Regarding the warnings, you need to explicitly set the resave and saveUninitialized options in your session configuration object.

javascript – Node JS session error: express-session deprecated

Add these flags-

n

resave: true,nsaveUninitialized: truen

n

inside your – app.use(session({});nand it should work fine.

Leave a Reply

Your email address will not be published.