Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1020 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 1020 Bytes

Redux persist RESTful storage

use RESTful way to build a storage adaptor for redux-persist by implementing methods: setItem, getItem, removeItem and getAllKeys

install

npm install --save redux-persist-restful-storage

usage

import { AsyncRESTfulStorage } from 'redux-persist-restful-storage'
import { persistStore, autoRehydrate } from 'redux-persist'
const store = createStore(reducer, undefined, autoRehydrate())
persistStore(store, { storage: new AsyncRESTfulStorage() })

example

You need to build your own RESTful API server to communicate with redux-persist.

/example present an example with nodeJS. Use express to create a HTTP server and node-localstorage to save/get data.

To run with

npm init
npm install body-parser express node-localstorage
node nodeApiExample.js