Licence
ISC
Version
1.0.0
Deps
0
Vulns
0
Weekly
0
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
| variable | type | require |
|---|---|---|
| url | string | yes |
| data | object | yes |
| method | string ('post', 'get') | yes |
| format | string ('json', 'form') | yes |