Skip to content

tgohn/express-session-level

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status npm

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

About

Leveldb session store for Express.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published