expressjs/session

How do I invoke methods of the store ?

phquang98 opened this issue · 1 comments

I created a simple Node app with the default MemoryStore. I configured the options then tried to invoke a method from the store to see what happened (e.g store.all() ). But I got an error said the store is probably undefined. How do I invoke methods of the store ?
11

The config obj for the session:

const testStore = new MemoryStore()

export const serverSessOpts: SessionOptions = {
    secret: "123abc",
    name: "test_session",
    store: testStore,
    // store: default, use MemoryStore
    cookie: {
      maxAge: 50000,
      sameSite: "lax",
      secure: false
    },
    saveUninitialized: false,
    resave: false
  };

Then I used it before my routes, so it should be working

app.use(session(serverSessOpts))

// --- Run server ---
app.use(serverRouter);

Beginner trying to understand how to use this library. Hope to receive some answers. Thanks

I left comment from my experience.
You should install sessionstore to use .all()
https://www.npmjs.com/package/sessionstore