Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.57 KB

File metadata and controls

64 lines (45 loc) · 1.57 KB

redux-jarm

Build Status Coverage Status npm version Downloads

Offline-first redux ORM designed around JSONAPI servers.

API specification

Check out the full API Specification.

Additional resources:

Requirements

Jarm requires you to be using redux and redux-thunk in your middleware.

Installation

Install the package with yarn / npm:

yarn add redux-jarm
# npm install redux-jarm

Instantiate a Jarm object with your config:

import { createJarm } from 'redux-jarm'

const Jarm = createJarm({
  baseUrl: 'https://example.com/api'
  storeKey: 'models',
  schema: {
    User: {
      url: '/users/',
    },
  },
})

Register Jarm in your store's reducer:

import { createStore, combineReducers, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'

import Jarm from './jarm.js'

const reducer = combineReducers({
  models: Jarm.reducer,
})
const store = createStore(reducer, applyMiddleware(thunk))

Optionally, you can persist your Jarm state as documented here.