Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/davestewart/axios-actions

Bundle endpoints as callable, reusable services
https://github.com/davestewart/axios-actions

api endpoints rest

Last synced: about 1 month ago
JSON representation

Bundle endpoints as callable, reusable services

Awesome Lists containing this project

README

        

# Axios Actions

> Bundle endpoints as callable, reusable services

## Abstract

Axios Actions comprises a small set of classes which collate URLs or URL request configs as callable actions.

First, [define](docs/config.md) your endpoints:

```js
const actions = {
: '',
: '',
...
}
```

Then, encapsulate them as one of the built-in [services](docs/classes/README.md):

```js
const service = new (axios, actions)
```

Finally, [call](docs/classes/ApiGroup.md#usage) them:

```js
service
.()
.then()
```

This service-based approach:

- removes brittle configuration from components and stores
- encapsulates additional logic (such as load state and handlers) within the service
- ensures application code stays simple and semantic
- provides a dedicated layer for API interaction

There are lots of [other goodies](docs/tips.md) in the library which take the drudgery out of working with APIs!

## Documentation

Start reading:

- [Quick start](docs/quick-start.md)
- [Full docs](docs/README.md)

## Next steps

Demos:

- [axios-actions/demo](demo)

Installation:

```bash
npm i -S axios-actions
```