4 ms·
I second this, since fetch is a wrapper around xhr (though doesn’t have to be because node is a non-restricted runtime), and it diverged already for redirect se
by wruza 5y ago
I second this, since fetch is a wrapper around xhr (though doesn’t have to be because node is a non-restricted runtime), and it diverged already for redirect semantics. It’s news, but is it big?
- samtho 5y ago> It’s news, but is it big? As someone who has been working almost exclusively on Node.js applications for years now, this is big. Front-end developers have, for years, enjoyed this wrapper around the clunky XHR API. It is simple, intuitive, and it comes _free_ in the browser environment (and was easily shimmable before it was standard). Additionally, the depreciation of the popular request[0] a while ago, there has been a gap in The Right Way to do http requests without going into the low-level API that ‘http(s)’ provides. Fetch is promised-based (enabling seamless async/await) and, most importantly, standardized. Basically, fetch provides a meaningful abstraction atop each platforms’ implementation of http-request-doing further unifying server-side and client-side patterns and idioms. [0]: https://www.npmjs.com/package/request https://www.npmjs.com/package/request
- wruza 5y agonpm i request node-fetch make-fetch-happen axios. Just out of top of my head.
- ripley12 5y agoAs a person who only occasionally writes JS and has zero interest in keeping track of the differences between client-side and server-side JS - fetch has been a big friction point for me in the past, it's big news to me.