Have my backend running on localhost: 3601, and it’s not running on a dedicated server, just my laptop;
Have “http://localhost:3601” as “apiurl” in my settings.json;
When building use “http://localhost:3601” after --server;
Compile my code to run on my android;
The login page shows, but when I try to login which calls the backend login
function, it just returns “connection lost” despite knowing the apiurl.
What am I doing wrong here? I assume it’s some parameter i should
set when I build my code but I can’t quite figure out which one that is.
Hi I’ve not tried passing a static IP, i thought since the backend is just running on my laptop giving it localhost:3601 should be sufficient, which doesn’t seem to be the case. Anyway thx for your reply
If you want to access meteor from another machine on your network you need to enable this when starting meteor. This is done by setting the ROOT_URL environment variable. Localhost only works on the machine running meteor.
E.g ROOT_URL=192.192.192.192 meteor
Windows env variable is different and I think you need to use ‘set’ to configure.
Hi thanks for your reply, do I give the “ROOT_URL=192.192.192.192” to my front end app running on my phone or my backend? I’m not really sure in this case which one you are talking about, from “if you want to access meteor from another machine” is sounds like I should give this to my backend running on my laptop? Also should I replace 192.192.192.192 with my backend local ip or is 192.192.192.192 necessary?
Apply it to the backend when starting meteor. It should be the ip of your backend laptop to which your phone must also be connected Meteor by default only broadcasts to the local host (your laptop) and any other device on your network cannot access the meteor server.
Use command “ifconfig |grep inet” to find the ip address that looks like 192.168.., it’s shown after “inet”.
On my server side, which is running on my laptop:
ROOT_URL=“http://192.168.0.100:3601” meteor -p 3601
On my client side, which is running on my phone, in settings-dev.json:
“apiurl” : “http://192.168.0.100:3601”
And everything is working now. Seems that if you give it anything other than 192.168.. it
will block the incoming request, even if the ip address makes perfect sense.