In this doc, we'll explore two popular libraries: axios
and isomorphic-fetch
.
Quick facts:
- 37,439 stars on GitHub
- 130 contributors
- most recent commit: March 8th, 2018
- created in Aug. 2014
Features (taken from axios):
- Make XMLHttpRequests from the browser
- Make http requests from node.js
- Supports the Promise API
- Intercept request and response
- Transform request and response data
- Cancel requests
- Automatic transforms for JSON data
- Client side support for protecting against XSRF
- continuously mainted based on most recent commits
- larger number of contributors => more stable
- supported by lastest versions of all browsers
- performs automatic transforms of JSON data.
Quick facts:
- 5,385 stars on GitHub
- 9 contributors
- most recent commit: May 22nd, 2016
- created in Nov. 2014
- more downloads per month
- library is considered a polyfill.
- This adds
fetch
as a global so that its API is consistent between client and server.
Importantly, Axios is 4.3 KB while isomorphic-fetch is 2.7KB. Another library, isomorphic-unfetch is a mere 582B, and does everything I want it to. That's my pick fwiw :)