Home » ngrok

Tag: ngrok

Testing Localhost On Your Phone

Often times, developers find themselves in the situation that they want to test code on a remote device (ex. Their iPhone) from their local server(computer) rather than having to push it to a remote server each time there is a change.

For example, if you are creating a node.js application on your own personal computer and you wanted to see what it looks like on your cell phone. You would have to push the code to a remote server and load the ip address/ url on your phones browser.
Luckily ngrok helps solve this issue.

This tool securely exposes your localhost’s port to you network and creates a url that you can simply put in on a device on the same network.

Here’s how to use it.

 

  1. Download ngrok
  2. Run your application (ex. “npm start” for node.js) –> Note the port that your application is running on (ex: localhost:3000, 3000 is the port)
  3. In terminal, just type “ngrok http <port>” where <port> is the port number that your application is running on
  4. On your device, type in the forwarding ip address that is printed out. 
  5. All set! Test more efficiently!