Why doesn't fetch in Node.js work out of the box? What's the best alternative? or How do I use fetch

14 Replies, 775 Views

Wait, node-fetch is deprecated? Damn, I missed that memo lol.

Anyway, undici is the new hotness for fetch in nodejs. It’s faster and more modern. Axios is still solid tho, especially if you need interceptors or better error handling.

If you’re lazy (like me), just do `npm install undici` and use `import { fetch } from 'undici'`. Done.

Messages In This Thread



Users browsing this thread: 1 Guest(s)