Skip to content
redis providers for the bogart session jsgi middleware
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example
lib
.gitignore
README.md
package.json

README.md

Redis provider(s) for the Bogart "Session" JSGI middleware.

Example:

var bogart = require('bogart'),
    DataProvider = require("bogart-session-redis").DataProvider;

var config = function(show, create, update, destroy) {
  show('/', function(req) {
    req.session("foo", "bar");

    var session = "Session: <br /><ul>";
    req.session.keys().forEach(function(key) {
      session += "<li>"+key+": "+req.session(key)+"</li>";
    });
    session += "</ul>";

    return bogart.html(session);
  });
};

var dataProviderConfig = {
  lifetime: 600,
  redis: {
    port: 6379,
    host: "localhost"
  }
};

var sessionConfig = {
  options: {
    idProvider: {
      encryptionKey: "330e2e6e-0a94-11e1-9db7-935b9f6cc277"
    }
  },
  dataProvider: new DataProvider(dataProviderConfig)
};

var app = bogart.middleware.Session(sessionConfig, bogart.router(config));
bogart.start(app, {port:1337});
Something went wrong with that request. Please try again.