Calling JSON RPC API in javascript
In Chapter1 we used ethers.js
to get the latest block number from the Etherdata blockchain.
And now we will use pure node-fetch
to call the JSON RPC API.
info
node-fetch
is a light-weight module that brings window.fetch
to Node.js so that we can make a network request directly in node.
You will get the same result as we did in Chapter1.