Answer the question
In order to leave comments, you need to log in
Why are sessions not saved?
Hello.
I decided to try to add the possibility of authorization in the application through sessions,
but they are not saved.
I'm running it on my local machine ( localhost:3000/).
Code mixed from the official example and other guides:
app.use(session({
secret: 'some_pass',
resave: true,
saveUninitialized: true,
cookie: { httpOnly: false,
maxAge : 24*60*60*1000,
secure: false,
resave: false,
saveUninitialized: true,
unset: 'destroy',
domain: 'http://localhost:3000' }
}));
app.get('/', (req, res) => {
res.json(req.session);
req.session.test = "1";
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question