Now let's create a short script, let's call it `index.js`, to fetch the block height from our node. You can copy/paste this into your code editor:
var Web3 = require('web3');
var provider = 'ADD_YOUR_ETHEREUM_NODE_URL';
var web3Provider = new Web3.providers.HttpProvider(provider);
var web3 = new Web3(web3Provider);
web3.eth.getBlockNumber().then((result) => {
console.log("Latest Ethereum Block is ",result);
});
So go ahead and replace `ADD_YOUR_ETHEREUM_NODE_URL` with the http provider from the instructions above.
A quick explanation of the code above - we are importing the web3 library we installed earlier (line 1), setting our Ethereum node URL (line 2), instantiating a Web3 HttpProvider instance (line 3) and creating a Web3 instance (line 4). Finally, we're calling getBlockNumber on the web3 object and waiting for a successful result from the server (QuikNode) then logging the result to the console (lines 5-7).
Save this code snippet in a file index.js we're going to run this very shortly.