Express middleware for a redis connection.

Usage no npm install needed!

<script type="module">
  import expressRedis from '';


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.get('/', function (req, res, next) {
  req.db.get('some_key', function (err, reply) {
    if (err) {
      return res.status(500).end();


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, '', 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