Remix.run Logo
cyco130 8 hours ago

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.

lelanthran an hour ago | parent | 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.

Nor is fetch a good client-side API either; you want progress indicators, on both upload and download. Fetch is a poor API all-round.

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

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 6 hours ago | parent | next [-]

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

nailer 6 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.

augusto-moura 5 hours ago | parent | next [-]

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

nailer 15 minutes ago | parent [-]

Sure but Axios determine what the official replacement for Axios is.

kube-system 2 hours ago | parent | prev [-]

It's not deprecated, it's obsoleted.

sieabahlpark 2 hours ago | parent [-]

[dead]