node-persistent-redux
v0.1.1
Published
Persistent redux store for node apps
Downloads
7
Readme
Persistent Redux
Persistent redux store for node apps.
Getting Started
The goal of this library is to provide a very straighforward way to write a redux store to disk. This can be useful in case you want to store a configuration, like for example with electron.
# Add the lib to your project and you are good to go.
$ yarn add node-persistent-redux
# Not in a hurry? Use npm.
$ npm install --save node-persistent-redux
Sample Code
import createPersistence from 'node-persistent-redux';
// Create redux middleware by specifying a location.
// The data will be stored in a Json on the specified location.
// It will not remove data that is already stored, however it will
// override the 'state' value of the Json. If the file does not
// exists, it will be created.
const persistence = createPersistence('~/.app-name');
// Now add the persistence middleware to the store.
const store = createStore(reducer, applyMiddleware(persistence));
Running the tests
$ git clone https://github.com/Jense5/node-persistent-redux
$ cd node-persistent-redux
$ yarn install
$ yarn test
Credits
- Jensen Bernard - Initial work & maintenance - Jense5
This project is licensed under the MIT License - see the license file for details.