Picture this scenario :
You have built a web app that has webhooks from other service. But everytime you want to test it out, you have to deploy your app, and keep a look out on your logs as the request trickles in.
You are working with a mobile developer in-house, and you both want to test an API. You deploy the app, even if it is a minute change and then wait to see if all works properly.
I am sure, as a developer, we have all been there. Deploying apps for a couple of small changes, and make it run through your entire CI/CD cycle can be exhausting. And so I was delighted, when I stumbled upon ngrok.
ngrok is a tool that allows you to access your localhost via Internet. This can save you from countless hours of frustrations by avoiding deploying code for minor changes.
Running ngrok is as simple as downloading the relevant files from the website. Once downloaded, on Mac / Linux – type
Once you have unzipped the contents, ensure your localhost is running and you know the port number. To get your server accessible via Internet, type
./ngrok http your-port-number
This would start ngrok, and now your web app is publicly accessible via the Internet. The terminal also shows the incoming request to your app.
The Tunnel URL in my case is https://41097f2f226f.ngrok.io, which points to port 8000 on my device. You can now update the tunnel URL in your webhooks, or pass it on to your client to test the app.
One cool feature of ngrok is it’s live dashboard – which allows you to inspect the status of server as well as the requests that are coming in. You can access this dashboard by navigating to http://localhost:4040/inspect/http
Apart from using ngrok for development, you can also use it to host your own webmail or other apps. ngrok also offers a paid tier with support for custom domains and other features.
ngrok has been easily one of the tools that has saved me hours of development time, and the paid plan is just worth it.