Live data from Hacker News

Fetch API has landed into Node.js

github.com

121–130 of 210 posts

Re: Fetch API has landed into Node.js

#121
post #94

As someone browser focused this surprised me. I've been using fetch() for years now.

Intercommunicating backend services isn't new, but having an HTTP API call another one from the backend is a case that used to be more normally accomplished by calling both APIs from the frontend. The slow ooze of browser-oriented thinking onto the backend took time. Existing backend engineers, who thought it a harebrained scheme, had to eventually wear down, and give up.

So when you write an application that integrates with an external service via an HTTP API, you think the normal way to architect such an application is to make all API requests from the browser? And you think that making such calls from the backend is a new and "harebrained" idea that backend devs have been forced to adopt against their better judgement?

I'm curious to know what position you occupy in our industry?

Re: Fetch API has landed into Node.js

#122
post #5

Brief explanation?

node js is a web software platform over a decade old that does not include a stable API for making a web request so there are a bunch of community libraries for making a web request, and which one is "best practice" has changed like four or five times through the years. this is a new api for making a web request. yayy progress.

Re: Fetch API has landed into Node.js

#123
post #112

Earlier quoted context omitted.

Really happy to see fetch() merged into core! Looking at the PR, what are those WASM blobs in Undici and how is it that Node.js accepts a random very large compiled blob instead of asking for the source file + compilation step? https://github.com/nodejs/node/commit/6ec225392675c92b102d3c...

Those wasm blobs are Node's own llhttp https://github.com/nodejs/llhttp in wasm to speed up HTTP parsing. The project itself added as a dependency is also by Node https://github.com/nodejs/undici . The question is totally legitimate but please assume core doesn't make "load random binary" level kind of goofs :)

Sorry def didn't mean in a bad way! I just wanted to ask/note that in the PR, and with the very little context I have, it seems like an arbitrary code blob so I was surprised, I'm 100% it'll be well documented in e.g. undici itself, and prob in other places.

Re: Fetch API has landed into Node.js

#124

Earlier quoted context omitted.

Because Node is legacy and Ryan Dahl moved on to Deno... Node is just an outdated 'standard' at this point.

I don't think that's an accurate characterization of the fork.

Calling it a fork certainly isn't accurate...

Re: Fetch API has landed into Node.js

#127
post #4

Hey, Node core person here (and the person who triggered the land) - we're super excited for this and would love help and feedback. This is still experimental and we'd love to hear from the community what you'd like to see.

Great work! Curious to check but quick question: does it support upload progress? If not, is it considered?

You can upload a stream and monitor that for upload progress - so sure.

If you upload a string for example you would have to take an extra step to get upload progress (make it into a stream and monitor that).

There is additional (unrelated) talk in the fetch standard itself to provide this sort of functionality as part of `fetch` which would save the middle step.

Re: Fetch API has landed into Node.js

#129
post #4

Hey, Node core person here (and the person who triggered the land) - we're super excited for this and would love help and feedback. This is still experimental and we'd love to hear from the community what you'd like to see.

Is there support for timeouts? It's the main reason I use https://github.com/sindresorhus/got

Re: Fetch API has landed into Node.js

#130
post #4

Hey, Node core person here (and the person who triggered the land) - we're super excited for this and would love help and feedback. This is still experimental and we'd love to hear from the community what you'd like to see.

Hi there,

> ...we'd love to hear from the community what you'd like to see.

In our tests, fetch on Deno was wayy faster than undici fetch that now has been merged into nodejs.

I couldn't figure out why that was case, but forwarding requests over node's http2 client (instead of undici fetch) then had comparable (but not as fast) performance as Deno (presumably because our hand rolled impl lacked connection pooling).

Post reply on HN