koajs / session

Simple session middleware for koa
MIT License
902 stars 113 forks source link

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

Closed zaynv closed 6 years ago

zaynv commented 6 years ago

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))
dead-horse commented 6 years ago

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.