Last updated on June 13, 2022
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);
}