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
Post a Comment