This content originally appeared on DEV Community and was authored by The Ninja Programmer
In this post, we will tell you how you can take the API on your machine to be accessible from WWW by using a powerful and free tool called ngrok.
The Problem
Many times we developers develop APIs for our apps. But when we are working in a team and you need to give access to your API to other team members, you just have one option, upload it to a server. This process is very time-consuming.
The Solution
Wouldn't it be easy to simply take the API from localhost to WWW so that anyone could access it? Well, that's exactly what NGrok does for you.
How does it help?
Suppose, I am developing an API that gives me the list of food items. As I am developing it on my machine, the URL to access this would be
Now, I would like my colleague to access this endpoint. So, to do that, I will use ngrok.
Step 1:
Simply visit https://ngrok.com/ and download the ngrok.
Step 2:
Now before using ngrok you have to first set the auth token. So simply go to the ngrok site and get the auth token by creating the account. Now run the below command with your auth token.
Step 3:
Lastly, just run the below command by specifying the port no on which you want to receive the request from WWW.
In My case, it is 80 because my xampp is running on port 80.
Result
Now you will get a random WWW URL from NGROK.
By using this URL anyone can access your localhost API.
Thank you for reading!
Follow us on Instagram
https://www.instagram.com/the.ninja.programmer/
This content originally appeared on DEV Community and was authored by The Ninja Programmer
The Ninja Programmer | Sciencx (2021-04-13T13:19:51+00:00) Take your localhost API to be accessible from WWW. Retrieved from https://www.scien.cx/2021/04/13/take-your-localhost-api-to-be-accessible-from-www/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.