2.0.1 • Published 6 years ago

express-redis v2.0.1

Weekly downloads
111
License
MIT
Repository
github
Last release
6 years ago

Redis Express Middleware

Greenkeeper badge

Build Status Coverage Status

This is a simple express middleware for redis and provides a shared redis db object across all requests.

Basic Usage

app.use(require('express-redis')());

app.get('/', function (req, res, next) {
  req.db.get('some_key', function (err, reply) {
    if (err) {
      return res.status(500).end();
    }

    res.json(reply);
  });
});

Advanced Usage

Any options available to the redis.createClient method may be used when instantiating the redis middleware:

var options = {
  return_buffers: true,
  auth_pass: 'superSecretPassword'
};
app.use(require('express-redis')(6379, '127.0.0.1', options, 'name'));

The name string allows you to specify a custom varaible name to provide the middleware on for example providing the name 'redis' would allow you to access redis via res.redis

2.0.1

6 years ago

2.0.0

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.2

9 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago