The Redis connector enables LoopBack applications to connect to Redis data sources.
StrongLoop Labs

This project provides early access to advanced or experimental functionality. It may lack usability, completeness, documentation, and robustness, and may be outdated.

However, StrongLoop supports this project. Community users, please report bugs on GitHub.

For more information, see StrongLoop Labs.

Page Contents

Installation

In your application root directory, enter this command to install the connector:

$ npm install loopback-connector-redis --save

This will install the module and add it as a dependency to the application’s package.json file.

Creating a Redis data source

Use the data source generator to add a Redis data source to your application. When prompted for the connector, choose other, then enter redis for the connector name. The entry in the application’s server/datasources.json will look like this:

server/datasources.json

"redisDS": {
  "name": "redisDS",
  "connector": "redis",
}

Edit datasources.json to add other properties that enable you to connect the data source to a Redis database.

Properties

Property Type Description
connector String

Connector name, either "loopback-connector-redis" or "redis"

database String Database name
host String Database host name. For connector versions <= v0.1.0, when this property is set, the port property **must also** be set.
password String Password to connect to database
port Number Database TCP port
url String Use instead host and port properties.
username String Username to connect to database
Tags: connectors