Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yooneskh/ynetwork
Javascript Network request interface and helper.
https://github.com/yooneskh/ynetwork
axios javascript network request
Last synced: about 1 month ago
JSON representation
Javascript Network request interface and helper.
- Host: GitHub
- URL: https://github.com/yooneskh/ynetwork
- Owner: yooneskh
- License: mit
- Created: 2018-03-19T20:16:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-23T20:04:58.000Z (over 1 year ago)
- Last Synced: 2024-12-10T00:54:53.031Z (about 1 month ago)
- Topics: axios, javascript, network, request
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YNetwork
A simple wrapper around axios to simplify making requests and retrieving data.## What YNetwork provides
- `async/await`
- does not throw erros. You always have the response in result and must check for errors yourself. This simplifies some things on frontend. (Opinionated)
- Simpler access to response attributes. `const { status, result, headers } = await YNetwork.xxx()`
- Global `headers` that is spread in every request. `YNetwork.headers.xxx = ''`
- Local headers for every request. `YNetwork.xxx(url, payload, headers)`YNetwork introduces two concpts which could have been done with axios too but have been made simpler (kind of).
## Short Circuit
You can apply multiple short circuits on YNetwork and conditionally and if you return something, that will be used as the result of that request.## Preprocess
You can apply multiple pre processors on the response. Pre processors can change the response or dismiss a response completely.