Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including session-rethinkdb with all npm packages installed. Try it out:

require("rethinkdbdash/package.json"); // rethinkdbdash is a peer dependency. var sessionRethinkdb = require("session-rethinkdb")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

session-rethinkdb v2.0.1

RethinkDB session store for Express and Connect

session-rethinkdb

NPM Version NPM Downloads Node.js Version Build Status Dependency Status Coverage Status

NPM

downloads-url

RethinkDB session store for Express and Connect.

Installation

npm install session-rethinkdb

Usage

const r = require('rethinkdbdash')();
const session = require('express-session');
const RDBStore = require('session-rethinkdb')(session);

const store = new SessionStore(r, {
  browserSessionsMaxAge: 60000, // optional, default is 60000. After how much time should an expired session be cleared from the database
  clearInterval: 60000, // optional, default is 60000. How often do you want to check and clear expired sessions
});

app.use(session({
    // https://github.com/expressjs/session#options
    secret: 'keyboard cat',
        // Pass the store to express-session
    store: store,
        // This needs to be set for session-rethinkdb to work!
    resave: true,
    saveUninitialized: true
}));

Note: The API has changed in v2.0.

Refer to the example application for a full example.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free