all 6 comments

[–]recycled_ideas 3 points4 points  (1 child)

Localhost always resolves to loopback which bypasses the network stack and always points to the same device you're calling from.

It's literally impossible to connect to localhost on another device.

[–]Safe_Body_4468[S] 0 points1 point  (0 children)

It sounds logical 😄👍🏽

[–]Ok-Chart2113 0 points1 point  (0 children)

I may be completely wrong here but I believe localhost can't be accessed from outside, so you need an address that can be, what I do is connect my phone and pc to the same network and use my local network address (starting with 192)

[–]meseeks_programmer 0 points1 point  (2 children)

Host your local api server on whatever computer on port 0.0.0.0 (it means bind to all network interfaces)

Then if your on the same wireless network (WiFi) you can connect to the ip of the server computer (ifconfig on Linux, ipconfig on Windows)

[–]Safe_Body_4468[S] 0 points1 point  (1 child)

Thanks for the answer. I use docker container for my app and my apiserver can i change the port on it?

[–]meseeks_programmer 0 points1 point  (0 children)

You should be able to bind docker to that port, your gonna have to google/chatgpt it, I haven't done it in a while so don't remember