Testing Blockonomics API’s Locally

In this tutorial, we are going to look at how to test your application having Blockonomics APIs before deploying it on the cloud. We are going to use a reverse proxy to expose a specific port of our local machine on a public network. These will allow anyone on the internet to have a look at your application and also helps you to perform testing.

Resources

Youtube Video https://www.youtube.com/watch?v=6Ydk32avIgo

There are various vendors out there each having their own tradeoffs, some are open source too. Some of them are listed below –

  • localtunnel
  • ngrok
  • Serveo
  • Pagekite
  • Openport
  • Teleconsole

Today, we are going to look at ngrok.

Installation

You can download ngrok from their official website. Once you download it, unzip the folder.

Running ngrok

Open up the terminal inside the unzipped folder. You can also add it to your PATH to have access from your terminal irrespective of your current location inside the terminal. The next step is to run the command –

ngrok http 8000

Here 8000 is the port number and you can change it to any port on which your application server is running. Once you complete it, you will be able to see a public URL on your terminal which can be shared.

The highlighted is my public URL.

HTTP CallBack URL

To complete the testing setup, you have to replace the HTTP Callback URL of your store with this new public URL, and do not forget to append your route. So let us say you receive your public URL from ngrok as https://ngrok-demo-url.ngrok.io and your route for HTTP CallBack URL is /callbacks/store_01. Then you have to enter your HTTP CallBack URL as https://ngrok-demo-url.ngrok.io/callbacks/store_01.

Now your setup is ready for testing and it should work!