Redis adapter for JSData on Node.js

js-data logo

Slack Status npm version Travis CI npm downloads Coverage Status Codacy

Table of contents

Quick Start

npm install --save js-data@beta js-data-redis@beta redis
import express from 'express'
import store from './store'

const app = express()

  .post('/', async function (req, res) {
    res.send(await store.create('post', req.body))
  .get('/:id', async function (req, res) {
    res.send(await store.find('post', req.params.id))
	.put('/:id', async function (req, res) {
    res.send(await store.update('post', req.params.id, req.body))
  .delete('/:id', async function (req, res) {
    res.send(await store.destroy('post', req.params.id))

app.listen(3000, function () {
  console.log('Example app listening on port 3000!')
import RedisAdapter from 'js-data-redis'

// Create an instance of RethinkDBAdapter
export default const adapter = new RedisAdapter({
  host: process.env.DB_HOST,
  port: process.env.DB_POST
// Use Container instead of DataStore on the server
import {Container} from 'js-data'
import adapter from './adapter'

// Create a store to hold your Mappers
export default const store = new Container()

// Mappers in "store" will use the RethinkDB adapter by default
store.registerAdapter('redis', adapter, { default: true })


Configuring the adapter




See an issue with this tutorial?

You can open an issue or better yet, suggest edits right on this page.


Need support?

Have a technical question? Post on the JSData Stack Overflow channel or the Mailing list.

Want to chat with the community? Hop onto the JSData Slack channel.