Like any dev, I sometimes want to test small pieces of code, make an example landing page to test a service or API...
In short, there are many cases where you just want to try something out, without it being a full-fledged project.
To do this, of course, we run our development environment on our own machine, "locally".
Okay, that's all well and good, but what if we need to access this local code from the outside?
And yes, it can happen. For example, I had this problem when I wanted to code something related to QR codes (this will be the subject of a future article ;) ). How can I open a page linked to a QR code from my phone if the page isn't available online?
That's why I used Ngrok.
Ngrok is a handy little tool that lets you use a tunnel system to access any site or application running on your machine.
All you need to do is download a small executable which you can then run from the command line, specifying the type of protocol and the port on which your application is running locally.
Your terminal will then display a URL such as "http://xxxxxxx.ngrok.io", as well as the HTTPS version. All you have to do is go to this URL to access your page running locally. Magic, isn't it?
Ngrok is available in a free version that lets you create a single tunnel at a time, so it's really handy for testing out different things. But if you need it for more advanced use(the doc allows many more configurations) or even for production, you'll need to upgrade to the Premium version, available from $5 a month.