Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cheesecakelabs/fetch
Opinionated fetch wrapper for modern front-end.
https://github.com/cheesecakelabs/fetch
fetch front-end javascript rest-api
Last synced: 3 days ago
JSON representation
Opinionated fetch wrapper for modern front-end.
- Host: GitHub
- URL: https://github.com/cheesecakelabs/fetch
- Owner: CheesecakeLabs
- Created: 2017-02-03T11:24:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T10:44:58.000Z (about 7 years ago)
- Last Synced: 2024-11-06T13:57:02.435Z (12 days ago)
- Topics: fetch, front-end, javascript, rest-api
- Language: JavaScript
- Homepage:
- Size: 58.6 KB
- Stars: 5
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fetch
Opinionated fetch wrapper for modern front-end.
## Install
```
yarn add @cheesecakelabs/fetch
```## Initialize
```javascript
import CKLFetch from '@cheesecakelabs/fetch'const fetch = new CKLFetch('http://your_api.io/api/v1/')
fetch.get('users')
fetch.post('users', options, body)
fetch.patch('users', options, body)
fetch.put('users', options, body)
fetch.delete('users')
fetch.upload('users', options, formData)fetch.get(['campaigns', 'my-campaign-id'], { key, params })
const data = new FormData()
data.append('file', payload.image)
data.append('upload_preset', UPLOAD_PRESET)
fetch.upload('some-ednpoint', {}, data)
```