You can get a public URL for your server running on a specific port on localhost.
At my workplace, I could access the local server using the local IP address of my machine in the application, like most other answers. But at home I could not do this for some reason. After trying many answers and spending many hours, I came across https://ngrok.com . This is pretty straight forward. Just download it from the folder:
ngrok portnumber
(from the command line in windows)
./ngrok portnumber
(from terminal on Linux)
This will give you a public URL for your local server running on this port number on localhost. You can enable and debug your application using this URL.
You can safely set your local web server on the Internet and fully monitor all traffic. You can also share the URL with a peer developer who can work remotely and can debug application and server interactions.
Hope this someday saves time.
source share