The solution provided by Balloon Fight is absolutely what I was looking for and it works.
But the command mentioned didn't work for me, so here is what worked for me.
I am using Lubuntu 20.04 LTS (64-bit).
Lubuntu is a lightweight Linux flavor using Debian, Ubuntu and LXDE as its base.
Steps for OSX would probably be similar. Steps for Windows and Ubuntu GNOME are also mentioned.
Go to ngrok and create an account.
Download ngrok and install.
For Windows, just unzip the file and open it. It'll run in cmd.
For Ubuntu GNOME, you would probably be able to run the file directly in terminal.
For Lubuntu (or if previous didn't work for you).
Move the file as follows:
mv "path/to/ngrok" "/usr/bin/"
If the file had directly opened up in terminal or cmd. Copy and paste the command from your profile on ngrok into cmd or terminal. The command looks like this:
./ngrok authtoken <your_auth_token>
If you are on Lubuntu, or if the file did not open directly in terminal. Change directory as follows:
cd "/usr/bin/"
And then copy and paste the command from your profile on ngrok into terminal. The command looks like this:
./ngrok authtoken <your_auth_token>
Run your server. Nodejs or what you usually use.
If you are still in the same directory as 'ngrok' file. Copy and paste the following command into terminal or cmd:
ngrok http 3000 -host-header="localhost:3000"
Change 3000
to the port you are using for the local server.
If you are out of 'ngrok' file's directory. Open it up in terminal or cmd.
For Lubuntu, use the following command to change directory:
cd "/usr/bin/"
Then run the command:
ngrok http 3000 -host-header="localhost:3000"
Change 3000
to the port you are using for the local server.
I got to know about this command from this video.
- Copy and paste the HTTPS link, in the second 'Forwarding' row, to your browser.
The link looks something like this: https://12fab5c82c57.ngrok.io
For the next time you are required to do it. Just repeat step 4, 5 and 6.