level-session-store

2.2.0 • Public • Published

Circle CI

Level-Session-Store

Greenkeeper badge A session storage module for expressjs/session that uses level/level to store data.

Note: this is different than rvagg/node-level-session in that it requires express-session to operate. It is merely a backing store.

Installation

npm install --save level-session-store

Usage

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

So long as you have level installed (it is listed as a peerDependency) this will create a new level db and use it for storing sessions.

You don't like the default location it puts it?

var app = require('express')();
var session = require('express-session');
var LevelStore = require('level-session-store')(session);
var mw = session({
  store: new LevelStore('/path/to/where/you/want/it')
});
app.use(mw);

You already have a level instance you want it to use? Not a problem.

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

This will invoke "name munging" -- the keys for session stuff will prefixed with _session. You don't like that munging?

var app = require('express')();
var session = require('express-session');
var LevelStore = require('level-session-store')(session);
var mw = session({
  store: new LevelStore(myLevelInstance, {ns: '_sessionsAreRadicalToTheExtreme'})
});
app.use(mw);

License

Copyright 2015 Scripto. Available under the Apache 2 license.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.2.0210latest

Version History

VersionDownloads (Last 7 Days)Published
2.2.0210
2.1.07
2.0.20
2.0.10
2.0.00
1.2.01
1.1.20
1.1.10
1.1.01
1.0.00

Package Sidebar

Install

npm i level-session-store

Weekly Downloads

219

Version

2.2.0

License

Apache-2.0

Unpacked Size

11.8 kB

Total Files

7

Last publish

Collaborators

  • scripto
  • toddself