New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rexios

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rexios

Normalize url params and data for axios rest api request

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

rexios

Utils normalize url params and data for axios rest api request

Actions Statusnodenpm versionDependency StatusXO code styleCoveralls status

npm downloadsnpm

Why?

Returns normalized parameters and url according to the rest-api convention and saving a single request contract for axios

Install

$ npm install vue-rexios

Note: This project is compatible with node v10+

Usage

GET

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

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

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

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);
});

Keywords

vue

FAQs

Package last updated on 18 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts