Take your localhost API to be accessible from WWW

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 t…


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
Alt Text
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.
Alt Text

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.
Alt Text

Step 3:

Lastly, just run the below command by specifying the port no on which you want to receive the request from WWW.
Alt Text

In My case, it is 80 because my xampp is running on port 80.
Alt Text

Result

Now you will get a random WWW URL from NGROK.
Alt Text
By using this URL anyone can access your localhost API.
Alt Text

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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Take your localhost API to be accessible from WWW." The Ninja Programmer | Sciencx - Tuesday April 13, 2021, https://www.scien.cx/2021/04/13/take-your-localhost-api-to-be-accessible-from-www/
HARVARD
The Ninja Programmer | Sciencx Tuesday April 13, 2021 » Take your localhost API to be accessible from WWW., viewed ,<https://www.scien.cx/2021/04/13/take-your-localhost-api-to-be-accessible-from-www/>
VANCOUVER
The Ninja Programmer | Sciencx - » Take your localhost API to be accessible from WWW. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/13/take-your-localhost-api-to-be-accessible-from-www/
CHICAGO
" » Take your localhost API to be accessible from WWW." The Ninja Programmer | Sciencx - Accessed . https://www.scien.cx/2021/04/13/take-your-localhost-api-to-be-accessible-from-www/
IEEE
" » Take your localhost API to be accessible from WWW." The Ninja Programmer | Sciencx [Online]. Available: https://www.scien.cx/2021/04/13/take-your-localhost-api-to-be-accessible-from-www/. [Accessed: ]
rf:citation
» Take your localhost API to be accessible from WWW | The Ninja Programmer | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.