I have the following in my node js file
var express = require('express');
var util = require('./lib/utility');
var partials = require('express-partials');
var bodyParser = require('body-parser');
var session = require('express-session');
/* abstracted some code */
app.use(session({
genid: function(req) {
return genuuid(); // use UUIDs for session IDs
},
secret: 'keyboard cat'
}));
When I start the server, I get
express-session deprecated undefined resave option; provide resave option server.js
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option server.js
I am having a hard time figuring out what is deprecated? I copied the example from https://github.com/expressjs/session
When I try to load the page I get:
ReferenceError: genuuid is not defined at app.use.session.genid
From express 4.0 , express-session with odd warning message
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).
app.use(session({
secret: cookie_secret,
resave: true,
saveUninitialized: true
}));
You have to define the genuuid function somewhere. The express-session readme is assuming you have already implemented that.
Regarding the warnings, you need to explicitly set the resave and saveUninitialized options in your session configuration object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With