DEV Community

loading...
Cover image for Share your Web Projects Easily

Share your Web Projects Easily

kitarp profile image Pratik Singh ・2 min read

This article is about sharing your localhost as a link that anyone can access. We will achieve this using ngrok

what-is-localhost.png

As a Web Developer, whatever you work on has to be shared as a link that others can access. Irrespective of whether you are a Front-End or a Back-End dev, a MERN Stack or a LAMP Stack dev, I am assuming you know the importance of https://localhost.

What if I told you that the work on your localhost can be shared with others in a few simple steps?🤯

There are several methods of deploying your project on a server as a sharable link.
But the problem with this process that you have to-

  • Commit your code and Push it to an external server before anyone can see your progress.
  • This process is a time as well as a data-consuming process.
  • As a #CodeNewbie the process is even more tiresome as you have to learn all about git, GitHub, Heroku, AWS, etc.

The answer to all of these Problems is sharing your work without committing the code and pushing it to an external server. This is possible by tunneling your localhost on the internet using ngrok

Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels.

~ Lets get started ~

  • Download from here
  • Unzip the downloaded folder
  • Run the ngrok.exe
  • Log in to your account and head to the Dashboard
  • In the .exe file Command

    ./ngrok authtoken Your_Authentication_Key

  • Now Fire it up

    ./ngrok http 3000

    if your project is hosted on http://localhost:3000/

  • The terminal must look like this now-
    8d090eb7-d978-4824-8d29-ffc02751a359.jpg

  • This link you see can be shared with others to see your work.

So this link can be accessed by anyone and will work as long as you run the program on your computer.

Why should you use ngrok?

They have very good documentation, easy to use, and have a lot of uses that can help you with many projects that you might work on.

Screenshot 2020-12-24 142724.png

I used this while working on a project that was a video calling project so even a little adjustment had to be checked from both ends. Committing and deploying your code on a server has an alternative for now.

Discussion (23)

pic
Editor guide
Collapse
bias profile image
Tobias Nickel

once I implemented my own version for a localhost proxy. custom localtunnel.

When doing this, I definetly found the value in using it just as a service. i think it is great for exposing my raspberry pi.

Collapse
destro_mas profile image
Shahjada Talukdar

I made a video on ngrok few days back-

Collapse
kitarp profile image
Pratik Singh Author

Now that's Awesome.
Thanks for the video and reading my article

Collapse
ahmedghazi profile image
Ahmed

been using it for a while. Great to fix things live with clients.
But was hoping the livereload would work. Hope it will come in the next iteration.

Collapse
kitarp profile image
Pratik Singh Author

The next update hopefully covers this issue🤞

Collapse
rakesh profile image
Rakesh

didn't know this...thanks for sharing pratik

Collapse
kitarp profile image
Pratik Singh Author

My pleasure Rakesh.
Thanks for reading my article.
If you found it helpful do share it so that it might help others as well

Collapse
rakesh profile image
Collapse
jcubic profile image
Jakub T. Jankiewicz

Thanks for reminding about ngrok.

Collapse
kitarp profile image
Pratik Singh Author

My Pleasure.
Thanks for reading my artcle

Collapse
cdthomp1 profile image
Cameron Thompson

Can’t wait to try this!

Collapse
kitarp profile image
Collapse
kzzm profile image
Kris M.

Thank you. A nice alternative to spinning up something on Heroku (or similar).

Collapse
kitarp profile image
Pratik Singh Author

My pleasure😊
Thank you for reading my article

Collapse
koas profile image
Koas

ngrok it's a great piece of software, I've been using it a lot recently while developing a Telegram bot, it allows you to get the Telegram messages on your localhost.

Collapse
kitarp profile image
Pratik Singh Author

I agree the possibilities are great.
I was planning to use it on a Raspberry pi Once

Collapse
sahamalam profile image
Saham Alam

Great tool.

Collapse
kitarp profile image
Pratik Singh Author

I know Right🤯👏

Collapse
somos404 profile image
Somos 404

fuaaaaaaaaaaaa me salvaste de un problemazo que estaba teniendo con una pasarela de pagos. Muchas gracias!

Collapse
kitarp profile image
Pratik Singh Author

El gusto es mio.
Gracias por leer mi artículo

Collapse
aadswebdesign profile image
Aad Pouw • Edited

Instead of 'localhost' can use this service for 'mywebsite.local' too?

Collapse
hackerup profile image
Hacker Up

Old shit 😉😁

Collapse
kitarp profile image
Pratik Singh Author

I am a #CodeNewbie so it seemed pretty new to me😂
Thanks for reading my article