DEV Community

Cover image for How to Access Local Sever on Other Devices
Jatin Sharma
Jatin Sharma

Posted on • Originally published at j471n.in

How to Access Local Sever on Other Devices

In this article, I am going to show you how you can access your local/localhost server on any other device (Android or iOS).

To access your local server, you only one thing IP Address of the device where the server is running. Now there could be two scenarios where you are using Windows or Mac. You just need to get the IP Address. Let me show you how:

Open windows terminal and type ipconfig in the command line and you will get the following output:

windows IP

You only need an IPv4 address and as you get it type this in your mobile browser followed by PORT. For instance-

# IPv4:PORT 
192.168.64.201:3000
Enter fullscreen mode Exit fullscreen mode

And if you are running any web app on localhost:3000 then you will be able to see that on your mobile devices also.

For Mac users you have to do the same-

  • Get the IPv4 (use ifconfig command)
  • Put that on your mobile device followed by PORT

And hurray!!!

If you are unable to fine the mac IP address then you can take a look the following article:

How to Find Your IP Address on a Mac

Following is the Video demo of how it works:

Wrapping up

That's all you need to run you localhost server on other devices. If you enjoyed this article, then don't forget to give โค๏ธ and Bookmark ๐Ÿท๏ธfor later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.

๐ŸŒ Connect with me:

Twitter
Github
Instagram
Newsletter
LinkedIn
Website
Buy me a Coffee

Top comments (9)

Collapse
 
kolja profile image
Kolja

Or you use ngrok ๐Ÿ˜Ž

Collapse
 
j471n profile image
Jatin Sharma

Yes that's also cool

Collapse
 
calebpitan profile image
Caleb Adepitan • Edited
ipconfig getifaddr en0
Enter fullscreen mode Exit fullscreen mode

Should also get you your IPv4 addr on a Mac. You may even go ahead and pipe it to pbcopy

ipconfig getifaddr en0 | pbcopy
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jpcarvalho profile image
Jean-Pierre Carvalho

In some scenarios en0 it's not the network we are searching and it's better do:

ifconfig | grep "192"
Enter fullscreen mode Exit fullscreen mode
Collapse
 
katamo profile image
ร“scar de la Mata

In mac, just click in your wifi/ connections icon (top bar) while pressing option key.
This will show you your connection details including the internal IP ;)

Collapse
 
riju_bro profile image
riju_bro

Of course, it wonโ€™t work. There is no doubt.

Collapse
 
j471n profile image
Jatin Sharma • Edited

Well, I use it all the time. I think you should give it a try.

Collapse
 
nirajkaushal profile image
Niraj Kaushal

It depends, if the web app has some sort of configuration that look for localhost to get the assets then this method will never work otherwise it will work.

Collapse
 
j471n profile image
Jatin Sharma

Could you be more specific about what kind of configuration?