express-session-level

1.0.0 • Public • Published

Build Status

Leveldb backed session store for your Express app.

Usage

npm install express-session-level express-session

Pass the express-session store into express-session-level to create a LevelStore constructor. The LevelStore constructor accepts a levelUP instance and an optional options object.

var session = require('express-session');
var LevelStore = require('express-session-level')(session);
var db = require('level')('./myDb');
 
app.use(session({
    store: new LevelStore(db)
}));

express-session-level

var LevelStore = require('express-session-level')(session);

Pass the express-session store into express-session-level to create a LevelStore constructor.

LevelStore

Create an express session store as:

var sessionStore = new LevelStore(levelup[, options])
  • levelup is an instance of levelUP. You can choose any backing store (levelDown, memDown ...) for the levelup instance.
  • options:
    • prefix: all saved keys to database will be prefix with this string. Default to empty string "".
    • levelTTLOptions: options will be passed straight to level-ttl. For example: { defaultTTL: 60000, checkFrequency: 30000 }

Dependencies

level-ttl to handle ttl of saved entries if you dont want the data store to keep growing.

levelup-defaults to make sure we do not polute your levelup instance.

License

MIT

Package Sidebar

Install

npm i express-session-level

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • tgohn