koa-resession
v0.1.2
Published
RethinkDB session for Koa 2
Downloads
8
Readme
Koa-ReSession
RethinkDB session storage for Koa 2. Uses async/await in favor of generator functions.
Getting Started
Install it via npm:
npm install koa-resession
And include in your project:
import ReSession from 'koa-resession';
import session from 'koa-generic-session';
import rethinkdbdash from 'rethinkdbdash';
const sessionStore = new ReSession({
connection: rethinkdbdash({host: 'localhost', port: 28015, db: 'session'}),
browserSessionsMaxAge: 5000,
db: 'session',
table: 'sessions'
});
sessionStore.setup();
export default convert(session({
store: sessionStore
}));
koa-resession
depends on rethinkdbdash or the default rethinkdb node.js driver. In addition,
it is built for use with koa-generic-session. This project is based off of
koa-generic-session-rethinkdb. Unfortunately that project seems unmaintained and has a dependency on co due to its usage of generators.
Session information is made available on ctx.session.
License
MIT
ToDo
- Finish writing tests
- Show a better example.