medea-session-store

2.2.0 • Public • Published

Medea-Session-Store

A session storage module for expressjs/session that uses medea/medea to store data.

Installation

npm install --save medea-session-store

Usage

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

So long as you have medea installed (it is listed as a peerDependency) this will create a new medea 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 MedeaStore = require('medea-session-store')(session);
var mw = session({
  store: new MedeaStore('/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 MedeaStore = require('medea-session-store')(session);
var mw = session({
  store: new LevelStore(myMedeaInstance)
});
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 MedeaStore = require('medea-session-store')(session);
var mw = session({
  store: new MedeaStore(myMedeaInstance, {ns: '_sessionsAreRadicalToTheExtreme'})
});
app.use(mw);

License

Copyright 2016 Benjamin VADANT. Available under the MIT license.

Base on Scripto's package level-session-store

Package Sidebar

Install

npm i medea-session-store

Weekly Downloads

1

Version

2.2.0

License

MIT

Unpacked Size

12.1 kB

Total Files

6

Last publish

Collaborators

  • benjaminvadant