Neighbor's Preppy Maltese

    connect-redsess

    0.1.0 • Public • Published

    connect-redsess Build status

    Redis session middleware for Connect/Express using Redsess.

    Installation

    npm install connect-redsess

    Usage

    var connect = require('connect');
    var connectRedsess = require('connect-redsess');
    var app = connect();
     
    app.use(connectRedsess());

    By default, the middleware will set the Redsess object onto req.session.

    req.session.get('auth', function (err, auth) {
      if (!auth) {
        // redirect to login page
      } else {
        // validate
      }
    });

    Constructor Options

    connectRedsess(options);

    Pass an object to connect-redsess on instantiation with any of Redsess' options as well as the following addition(s):

    • requestKey String The key at which to attach the Redsess object onto the req object. Defaults to session.

    req.redsessOptions

    You may also attach an object onto the req at req.redsessOptions with the same options as above. This is useful for any options that are set per-request (cookies, token, etc.). These will override any previously set.

    req.redsessOptions = {
      cookies: req.cookies
    };

    Keywords

    none

    Install

    npm i connect-redsess

    DownloadsWeekly Downloads

    9

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • mlmorg