# rexios

> Normalize url params and data for axios rest api request

Latest version **0.0.1** (published 2020-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install rexios
pnpm add rexios
yarn add rexios
bun add rexios
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-09-18 |
| First published | 2020-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Ivan Demidov |
| Maintainers | scrum |
| Keywords | vue, axios, rest, api |

## Links

- npm: https://www.npmjs.com/package/rexios
- Repository: https://github.com/Scrum/rexios
- Homepage: https://github.com/Scrum/rexios#readme
- Funding: https://patreon.com/scrums
- npm.io page: https://npm.io/package/rexios

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2020-09-18

## README

# rexios 
> Utils normalize url params and data for [axios](https://github.com/axios/axios) rest api request

[![Actions Status](https://github.com/Scrum/rexios/workflows/Actions%20Status/badge.svg?style=flat-square)](https://github.com/Scrum/rexios/actions?query=workflow%3A%22CI+tests%22)[![node](https://img.shields.io/node/v/rexios.svg?style=flat-square)]()[![npm version](https://img.shields.io/npm/v/rexios.svg?style=flat-square)](https://www.npmjs.com/package/rexios)[![Dependency Status](https://david-dm.org/Scrum/rexios.svg?style=flat-square)](https://david-dm.org/Scrum/rexios)[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/xojs/xo)[![Coveralls status](https://img.shields.io/coveralls/Scrum/rexios.svg?style=flat-square)](https://coveralls.io/r/Scrum/rexios)

[![npm downloads](https://img.shields.io/npm/dm/rexios.svg?style=flat-square)](https://www.npmjs.com/package/rexios)[![npm](https://img.shields.io/npm/dt/rexios.svg?style=flat-square)](https://www.npmjs.com/package/rexios)

## Why?
Returns normalized parameters and url according to the rest-api convention and saving a single request contract for [axios](https://github.com/axios/axios)

## Install

```bash
$ npm install vue-rexios
```

> **Note:** This project is compatible with node v10+

## Usage

### `GET`
```js
const axios = require('axios');
const rexios = require('rexios');

const method = 'get';
const baseURL = 'v2/api/user/';
const params = {
  id: 123, 
  article: 1,
};

const { args } = rexios({
  method,
  baseURL,
  params
});

// args => ['v2/api/user/123/?article=1']

axios[method](...args).then(response => {
  console.log(response);
});
```

### `POST`
```js
const axios = require('axios');
const rexios = require('rexios');

const method = 'post';
const baseURL = 'v2/api/user/';
const params = {
  id: 123, 
  article: 1,
};

const { args } = rexios({
  method,
  baseURL,
  params
});

// args => ['v2/api/user/', {id: 123, article: 1}]

axios[method](...args).then(response => {
  console.log(response);
});
```

### `PUT`
```js
const axios = require('axios');
const rexios = require('rexios');

const method = 'put';
const baseURL = 'v2/api/user/';
const params = {
  id: 123, 
  article: 1,
};

const { args } = rexios({
  method,
  baseURL,
  params
});

// args => ['v2/api/user/123/', {id: 123, article: 1}]

axios[method](...args).then(response => {
  console.log(response);
});
```

### `DELETE`
```js
const axios = require('axios');
const rexios = require('rexios');

const method = 'put';
const baseURL = 'v2/api/user/';
const params = {
  id: 123, 
  article: 1,
};

const { args } = rexios({
  method,
  baseURL,
  params
});

// args => ['v2/api/user/123/']

axios[method](...args).then(response => {
  console.log(response);
});
```

---
_Source: https://npm.io/package/rexios · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
