DEV Community

Cover image for Share your website with others without hosting it on cloud!!!
Ishan Mishra
Ishan Mishra

Posted on

5 2

Share your website with others without hosting it on cloud!!!

1. Overview

The method discussed in this article is not an alternative to hosting sites on cloud, its just a temporary way of sharing the website while it is under development phase.

2. Setup

We are going to use localtunnel to expose our localhost to the internet.

  • Step-1: Download and Install npm from here. Note: Node installer includes npm.
  • Step-2: Install localtunnel using following command
npm install -g localtunnel
Enter fullscreen mode Exit fullscreen mode

Note: You may need to add 'sudo' before npm in linux/mac systems.

This will install localtunnel globally. Read more about localtunnel here.

3. Expose localhost

For demo I am going to use a react based website, and run it on port 3001.

Screenshot_20210424_122806

Now the site is running on localhost, next step is to expose this localhost's port to internet, to do this we will run the following command on terminal

npx localtunnel -p 3001
Enter fullscreen mode Exit fullscreen mode

Replace '3001' with the port number your site running on

This command will generate a link, this link can be visited in any device in any location and will redirect to the localhost's port on our localsystem.
Note: We need to keep serving the website on our localsystem's port.

Screenshot_20210424_124023

4. Conclusion

Clearly this method is not an alternative to hosting the site on cloud, but can be very helpful for sharing websites/webapps, while they are under development. While setting up OAuth using facebook it requires redirect url with 'https' so localtunnel can be helpfull in this scenario too.


[1]: localtunnel


Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
luccinmasirika profile image
Luccin Masirika

Intersting 🤔

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay