expressjs / discussions

Public discussions for the Express.js organization
63 stars 15 forks source link

session confusion #62

Closed aitivinayak369 closed 6 years ago

aitivinayak369 commented 6 years ago

var express=require('express'); var session=require('express-session'); var FileStore=require('session-file-store')(session); var app=express(); app.use(session({secret:'secret',saveUninitialized:false,resave:false,store:new FileStore,name:"vinayak",cookie:{path:'/',httpOnly:true,name:'vinayak'},clg:'vnr'})); app.get('/',(req,res)=>{

console.log(req.session); console.log(req.sessionID); res.sendfile('./index.html');

}); app.get('/van',(req,res)=>{ console.log(req.session); console.log(req.sessionID); req.session.roll="123" res.sendfile('./index.html'); }) app.listen(5000,()=>{ console.log('Listening to port 5000'); });

->Info in cookie name:"vinayak" is sent back with session only once at first request only.I want it for every request .why it is happening ?how can i set that? ->I am newbie please help me. thanks.

wesleytodd commented 6 years ago

Hey @aitivinayak369, I was not watching this repo at the time. A better place to get feedback and real time help is the express gitter: https://gitter.im/expressjs/

Sorry no one noticed this question. And I hope you got it worked out.