Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I invoke methods of the store ? #915

Open
phquang98 opened this issue Oct 12, 2022 · 1 comment
Open

How do I invoke methods of the store ? #915

phquang98 opened this issue Oct 12, 2022 · 1 comment

Comments

@phquang98
Copy link

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

@Kedaiman
Copy link

Kedaiman commented Nov 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants