Remix.run Logo
afavour 8 hours ago

Irony is that Node has no need for Axios, native fetch support has been there for years, so in terms of network requests it is batteries included.

pier25 6 hours ago | parent | next [-]

People use axios or ky because with fetch you inevitably end up writing a small wrapper on top of it anyway.

zachrip 5 hours ago | parent | next [-]

Fetch has also lacked support for features that xhr has had for over a decade now. For example upload progress. It's slowly catching up though, upload progress is the only thing I'd choose xhr for.

afavour 6 hours ago | parent | prev | next [-]

Some might say the tradeoff of writing a small wrapper is worth it given what’s been demonstrated here.

pier25 6 hours ago | parent [-]

Yeah but what about other deps like db drivers?

jmull 5 hours ago | parent | prev [-]

In my experience people feel the need to wrap axios too.

kube-system an hour ago | parent [-]

These are the kind of people I hope AI replaces

fishpen0 2 hours ago | parent | prev | next [-]

It doesn't matter. We pulled axios out of our codebase, but it still ends up in there as a child or peer from 40 other dependencies. Many from major vendors like datadog, slack, twilio, nx (in the gcs-cache extension), etc...

zadikian 3 hours ago | parent | prev | next [-]

Node fetch is relatively new. Wasn't marked stable until 2023, though I've used it since like 2018.

cyco130 6 hours ago | parent | prev | next [-]

I'm not sure fetch is a good server-side API. The typical fetch-based code snippet `fetch(API_URL).then(r => r.json())` has no response body size limit and can potentially bring down a server due to memory exhaustion if the endpoint at API_URL malfunctions for some reason. Fine in the browser but to me it should be a no-no on the server.

augusto-moura 6 hours ago | parent [-]

Hm, I don't think axios would do much better here. `fetch` is the official replacement for axios. If both are flawed that's another topic

cyco130 4 hours ago | parent | next [-]

Axios has maxContentLength and maxBodyLength options. I would probably go with undici nowadays though (it also has maxResponseSize).

nailer 4 hours ago | parent | prev [-]

> `fetch` is the official replacement for axios.

No. Axios is still maintained. They have not deprecated the project in favor of fetch.

kube-system an hour ago | parent | next [-]

It's not deprecated, it's obsoleted.

sieabahlpark an hour ago | parent [-]

[dead]

augusto-moura 3 hours ago | parent | prev [-]

I'm not saying that axios is unmaintained, I'm saying that if you want something like axios from the standard lib, fetch is the closest thing you get to official

3 hours ago | parent | prev | next [-]
[deleted]
7 hours ago | parent | prev | next [-]
[deleted]
augusto-moura 6 hours ago | parent | prev | next [-]

It doesn't have a need _now_. Axios is more than 10 years old now, and even before axios other libraries did the same utility of making requests easier

MBCook 4 hours ago | parent | prev [-]

Browsers too.

It’s not needed anymore.