node.js - Express 4 Sessions not persisting when restarting server -
I have an Express 4 app setup for the session.
// Use the Session app (cookieParser ()); App.use (session ({secret: "something-secret"})); // signup ap. Post ("/ signup", function (rick, race) {create_user (req.body.user, function (mistake, user_id) {req.session.user_id = user_id; res.redirect ("/ admin" );});}); When I submit the form, it saves user_id to req.session. However, when I restart the server, the session expires.
Why is not this released? Do I miss some configuration?
The default session collection for Express-session is MemoryStore, which suggests that as the name, Only stores sessions in memory, if you need perseverance, there are many session stores available for express.
<
Comments
Post a Comment