I have created a website using uvicorn and react. I want this to test this using another computer so I was able to run the frontend (http://:) using my another computer. The problem is when I send request to backend it is not responding.
I have tried giving port number and host in my uvicorn app ie uvicorn.run("app:app", reload=True,port = 8000, host ='0.0.0.0')
but this is not working.
Both my computer and the other system are on the same network.
I tried running the http://: on my system it worked but not working on the other system
I do not want to use online sources such as ngrok etc.
2
Answers
If both of the systems are on same network you’ll be able to access the url from other system.
The system on which you have uvicorn server up, localhost:8000 will work, but if you try the same thing on different system which is on the same network it will not work. The reason is localhost -> 127.0.0.1 represents to the local system it doesn’t have any relation to the network with which your server is connected.
In order to make it work you’ll have to find the ip of your system which was assigned for that particular network, and use that ip in different system to connect with your server. You can find the ip using given command in terminal if you are using Mac/linux
You can do by finding your ip address , to check ip address in windows using below command
ipconfig
example : IPv4 Address: 192.168.1.11 , then in your browser write it in url 192.168.1.11:(port number), example -> 192.168.1.11:3000