Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing express server from different geo location

So me and my friend are working on a MERN Stack app, I am working on backend(Node.js) and he is working on Frontend(React.js). We are from different places, My Question is how he can access my localhost server, So as to hit on my APIs. Provide me with all the possible solutions so that my APIs are always available to him.

like image 352
mk2683 Avatar asked Oct 16 '22 13:10

mk2683


1 Answers

You need something like this: https://ngrok.com/

Ngrok is a tool that allows you to securely open a tunnel to your local machine while ngrok is running.

Its has a free plan, or you can pay for extra features like setting a custom domain

You can install ngrok as a global npm package with:

npm i -g ngrok

And then once your server is running locally, you can start ngrok in another terminal pane/window/session and point it to the port your server is running on, below we assume the port is ‘3000’:

ngrok http 3000

This will open the tunnel, and print a url you can send to your friend to make requests against. Requests made to the url will be proxied to your localhost at the specified port. It supports HTTPS as well.

like image 67
rodrigoap Avatar answered Oct 20 '22 23:10

rodrigoap