I am building a web application using Laravel for APIs and React for the frontend . I want to test the app on a mobile phone. I usually test React alone, and it works, but the information from the backend is not working (authentication, CRUD, etc.). Can I access it? I run React using npm run dev — –host and Laravel using php artisan serve –host=0.0.0.0 –port=8000, but nothing is displaying except the static data.
2
Answers
You can try this. Find the local IP of your PC running the localhost, then append the port to that IP when on your phone i.e. 192.168.1.5:3000.
Another solution is to use ngrok which is super easy to get running.
Try this:
ipconfig
php artisan serve --host=<yourIPv4>
http://<yourIPv4>:8000
Note: of course your phone and your serve must be connected to the same network