Our team decided that it would be helpful to use the same ajax library on our nodejs servers as we do in the browser. Having a consistent API in both domains should lend some sanity as devs jump between worlds!
I knew going into this that there are many JS AJAX libraries available. I didn't realize how many there are. Hundreds. To whittle down the list, I decided that competing libs must:
have a promise API, vs. node-callback style. we want support for async-await / yield syntax
browserdependency on the server
.catchblock execution, or if they must manually be inspected from the response.
axiosassumes HTTP 400s/500s are a failure mode, and bump you into
catch, which I think is a valid and acceptable practice.
I am a fan of axios, at current time. It comes with all the fixins at a reasonable file size. Give it a whirl!
|ajax / component-ajax (ForbeLindesay)||yes||yes||no||7.8k|
sizes not listed for non-browserified packages