1.0.0 • Published 7 years ago

multi-fetch v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

multi-fetch

Fetching data on 1 line

Version 1.0

Support raw fotmat

  • JSON
  • JAVASCRIPT
  • Text

Support form-data fotmat

  • FORM

Support method

  • POST
  • GET
  • PUT
  • DELETE
  • PATCH
  • COPY
  • HEAD
  • DELETE

Using

npm install multi-fetch --save

or

yarn add multi-fetch

Import on React or Nodejs file React (ES6) / can use async/await

import { FETCHING } from 'multi-fetch'
... class {
   async funtion {
      const response = await FETCHING('https://api.domain.com', {foo: '123', bar: '123'}, 'post', 'json');
   }
}

Nodejs

const FETCHING = require('multi-fetch').FETCHING
async funtion {
  const response = await FETCHING('https://api.domain.com', {foo: '123', bar: '123'}, 'post', 'json');
}

Function data

variabletyperequire
urlstringyes
dataobjectyes
methodstring ('post', 'get')yes
formatstring ('json', 'form')yes