koajs / session

Simple session middleware for koa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is this package compatible with `connect-*` stores?

zaynv opened this issue · comments

commented

For example, can I use something like https://www.npmjs.com/package/connect-pg-simple for my store that I pass to the session config, or do I need to manually create it like this:

const store = {
  set(key, sess, maxAge, { rolling, changed }) {
    // do INSERT query or UPDATE query depending on if session exists already
  },

  get(key, maxAge, { rolling }) {
    // SELECT query 
  },

  destroy(key) {
    // DELETE query
  }
}

app.use(session({ store }, app))

you can't use connect-pg-simple directly because it has the different interface, maybe you can wrap it to fit the interface koa-session required.