Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

Global fetch added in Node v18

Starting from Node.js v18 the fetch API is available on the global scope by default. So we don’t have to install the node-fetch or other packages to make HTTP requests. The new global fetch is based on the undici package.

Example:

const res = await fetch('https://gorest.co.in/public/v2/users');
if (res.ok) {
  const data = await res.json();
  console.log(data);
}

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments