open-index/open-npm huggingface dataset:
npm package: @sleegle/sthore
Description: Generate a react store and services using redux, redux-saga and axios
Author: Sleegle
Latest version: 1.1.3

![alt text](https://repository-images.githubusercontent.com/327449149/071af580-57b0-11eb-9c97-05907bdb0432)

# Sthore: Connect back-end API to react project with one command
Create your sthore-config file, put it in your project folder and run "sthore" command.
BANG! it will create a Redux-Saga based store and generate API Services files for your project and you can fully customize it :)
JUST ENJOY AND CHILL!

You can see Demo <a href="https://codesandbox.io/s/vibrant-hypatia-wpxk9">Here</a>. Files src/stores and src/services folders are auto generated using sthore with sthore.config.json file in project root.

## Installation

```bash
npm install @sleegle/sthore -g
```

or

```bash
yarn global add @sleegle/sthore
```

## Usage

1. Create your sthore.config.json file in project root

sthore.config.json template
```js
{
  "baseURL": "https://your_base_url",     // Backend URL
  "storesDir": "src/stores",              // Stores folder direction
  "servicesDir": "src/services",          // Services folder direction
  "stores": [
    {
      "name": "auth",               // Store name
      "actions": [                  // Store actions
        {
          "name": "login",          // Action name
          "url": "/auth/login",     // Action URL path
          "method": "POST",         // Action method
          "storage": [              // Response data that you want to put it in local storage
            "accessToken",          // For example response is {"accessToken" : "...", efreshToken":"..."}
            "refreshToken"
          ]
        },
        {
          "name": "user",
          "url": "/auth/user",
          "method": "GET"
        }
      ]
    },
    {
      "name": "users",
      "actions": [
        {
          "name": "getAll",
          "url": "/users",
          "method": "GET"
        },
        {
          "name": "single",
          "url": "/users/${id}",      // If you have dynamic rams in your request,
                                      // just put them in l like this "${param}
          "method": "GET"
        },
        {
          "name": "create",
          "url": "/users",
          "method": "POST"
        },
        {
          "name": "update",
          "url": "/users/${id}",
          "method": "PUT"
        },
        {
          "name": "remove",
          "url": "/users/${id}",
          "method": "DELETE"
        }
      ]
    }
  ]
}
```

2. Run sthore command

3. Your js files are generated