React native android connect backend service at localhost
There could be 2 cases to test this problem.
- Use Device
- Use Emulator
Key point is run below command
$adb reverse tcp:3001 tcp:3001
TEMPLATE: adb reverse tcp:{APPLICATIONPORT} tcp:{APPLICATIONPORT}
The first case is ipconfig inside pc and find local IP address like 192.168.1.4. Your url should like http://192.168.1.4:3001/user/register
If you use emulator, you should use following url like http://10.0.2.2:3001/user/register
These URLs worked me, after running adb reverse command.