Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
95
rated 0 times [  98] [ 3]  / answers: 1 / hits: 50218  / 9 Years ago, tue, march 3, 2015, 12:00:00

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



More From » node.js

 Answers
26

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.


[#67587] Sunday, March 1, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mustafaericho

Total Points: 322
Total Questions: 103
Total Answers: 110

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
mustafaericho questions
Mon, May 31, 21, 00:00, 3 Years ago
Sun, May 23, 21, 00:00, 3 Years ago
Sat, Feb 13, 21, 00:00, 3 Years ago
Sat, Jan 2, 21, 00:00, 3 Years ago
Thu, Nov 12, 20, 00:00, 4 Years ago
;