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

    Popular posts from this blog

    Java - Error: no suitable method found for add(int, java.lang.String) -

    java - JPA TypedQuery: Parameter value element did not match expected type -

    c++ - static template member variable has internal linkage but is not defined -