The *magic* of ngrok (aka how I show code to my mom)

HopeGiometti
2 min readNov 7, 2019

--

Recently, I spent perhaps too much time creating a Sinatra application that, while pointless, I knew I absolutely had to show to my family. As a coding newbie, however, I was pretty lost on how I could send an app hosted on my local server to family members that lived states away.

Enter: ngrok.

Ngrok creates a secure tunnel between your machine and a public URL. This means that once you have your ngrok tunnel set up, you can send the URL to anyone you want to be able to use your application, including, you guessed it, my mom.

So, if you, like me, want to send pointless web applications to my mom (or useful web applications, to anyone you’d like!), follow these steps:

  1. Install ngrok.

2. Once you have your ngrok downloaded and unzipped, open a new terminal window (cd into your “home” folder, if for some reason your aren’t already there), and type:

$ ./ngrok authtoken <paste your authtoken here> 

**your authtoken can be found on the ngrok setup and installation page

3. In a second terminal window, cd into your application directory and startup your local server (if like me, you are building an application using Sinatra, run rackup).

4. Return to your first terminal window and type:

./ngrok http <your local port>

5. You should now see a screen that looks something like this:

Now, you can copy the forwarding URL (either will technically work, but you should send the second as https is the secured server), send it to whoever you like, and they will be able to use your web application. Amazing!

Conclusion

Whether you need to share your application with clients, other developers, or my mom, ngrok is a powerful tool that makes sharing your code super easy and I hope you find it as useful and easy to use as I did!

P.S. If you are ever struggling with getting ngrok up and running, type ./ngrok help into your terminal and you will be able to see all of the ngrok documentation!

--

--

No responses yet