Saturday, April 1, 2017

how to make a localhost website public

There are some scenarios where you need to call your locally running rest service from world wide web.

i got a similar kind of requirement where i need to call the rest service running locally from AWS Lamda function.

so how i achieved this  using local tunnel (https://localtunnel.github.io/www/).

for this we need have node js installed in our system.

this is the link for the node js (https://nodejs.org/en/) if you haven't installed on your system.

after installing node js , you need install localtunnel package globally using the below command.

npm install -g localtunnel
after successful installation of localtunnel package , we need to run the command to assign an public domain to your local running port.

so for example if your server running on the port 8080, run the following command to give public domain.

lt --port 8080

and if you need any more regarding the lt command , you can use below command

lt --help