mysql - Expressjs session : undefined sessionid -


i getting null sessionid in expressjs application

here app.js file

var session = require('express-session');  var app = express();  app.use(cookieparser());  app.use('/loginaction',loginaction);   //session handling app.set('trust proxy', 1) // trust first proxy app.use(session({     secret: 'hellokitty',     resave: false,     saveuninitialized: true,     cookie: { secure: true }   })); 

in loginaction.js file located in routes folder.

router.post('/', function(req, res, next) {  console.log("session id"+req.sessionid);  //test session  req.session.test= 'something';  }); 

but session id undefined

also req.session.test through error cannot resolved test

your getting unidentified on req.sessionid because never sending sessionid client. requesting information request doesn't have. should try sending sessionid in initial login response. should remain persistent in request after (not sure on it's persistence tho, use different framework keeps persistent)


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -