Tunnel to localhost
Usually I find myself in the need to display my local on my phone, so, accessing to it can be quite easy with these ways:
ipconfig
Since I'm on mac, ipconfig
gives me a lot of info, sometimes that's quite noisy, so you can run:
ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2
That is going to give us our ip, now, with my phone connected to the same wifi, if my local is localhost:3000, I can go to {myIpAddress}:3000
and that's it, something like 191.xxx.x.xxx:3000
, don't forget adding https in your phone if you have it set it up in your local in the pc.
ngrok
There is no point on writing all the documentation of ngrok in this post, you can check it out here, this is a tunnel to localhost, works everywhere and you can get a url to share your local with your coworker or someone else.
- Download it and connect your account like it's mentioned here
- Open a terminal with path where you left your ngrok script and run:
// this will give you something like
// http(s)://12345.ngrok.io
./ngrok http 3000
// if your local runs in https, run it like this
./ngrok http https://localhost:3000
That's it, if you need more configs, you can find them in their docs.
Conclusion
So far, I hadn't need more tools to make that tunnel work, but if I do, I'll add more here, just wanted to write this post to have them handy somewhere.
Thanks for reading.