Exposing my api hosted on localhost to external world through internet
Just came across a beautiful tool
i really liked it and may be you’ll also like it.
Lets say i have a Restful service(example webapi code) in my PC , i am running it on port 4000.
So something like http://localhost:4000/getEmployeeDetails
will display my employee details.
Now i want these services to be used instantly by some mobile app or someone through internet for testing.
First of all i don’t have a domain or server to host my service and expose it over internet even for testing.
Now what i can do is i can download an exe provided by ngrok
You can simply download the zip file and unzip where ever we want in our file system.
Lets say i unzipped it in C:\Sotwares folder
And now from command prompt execute the following command.
Now follow these steps:
1. Open command promt and execute following command.
2. So lets say our api is exposed through port 4000. That is when i browse http://localhost:4000/getEmployeeDetails,
i’ll get employee details.
3. So i need to execute below commands
cd C:\Softwares ngrok http 4000
4. Now it will provide you with an url like http://abcfdd.ngrok.io
So now i can give this url to someone and they can access it through internet.
So to access my Employee service hosted on my localmachine he need to simply give
This really helps us to quickly do some testing.