Publish localhost website to the internet..
Need to show somebody your development website you’re running on localhost your desktop?
You could push the project to AWS/Digital Ocean or some other hoster etc and start it and that’s cool, but what about a one-liner to just allow the site to be seen by a colleague on the internet?
ngrok has now entered the chat.
How to use?
Log in with your github account or create an account.
Download the Linux client. Unzip the client to /usr/local/bin
and mark it executable.
sudo chmod +x /usr/local/bin/ngrok
Now click the ‘Getting started / Your AuthToken’ menu on the ngrok website and run the authtoken
commandline which looks something like this..
$ ngrok authtoken 1zdxnDpvAvPpqWrpNL6zIazyzIrQQWhqfKNRbF48bW123
OK, now you’re ready. Start your localhost website, e.g.
$ ./node_modules/.bin/vue-cli-service serve &
Now publish the site..
$ ngrok http 8080
If the site fails to publish because header is bad, just use the -host-header option, like this..
$ ngrok http 8080 -host-header="localhost:8080"
Once started you get the output below and you can copy and paste the URL to your messaging app / Skype / FB Chat etc., and voila.
Output..
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online Account clicktechnology (Plan: Free) Version 2.3.40 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://84de-213-152-186-35.ngrok.io -> http://localhost:8080 Forwarding https://84de-213-152-186-35.ngrok.io -> http://localhost:8080
Now message the URL to your Slack / MM whatever and watch people connect to your site.
Nice, huh?