Search code examples
mobilemobile-safariip-address

Testing Hoodie.js app on mobile: What URL to use?


Previously I was testing my app on mobile by using my IP followed by whichever localhost I was on. For instance, if I was on localhost:3000, I would plug 172.20.10.2:3000 into my mobile safari URL bar to view my app on mobile.

Now that I've installed hoodie.js, and I'm starting up my server with "hoodie start" in the command line, I've been unable to test on mobile using the same method.

This is what I see in my terminal when the server starts:

CouchDB started: 127.0.0.1:6003 Waiting for CouchDB [---*--] SUCCESS run static hook: server.pack.pre WWW:
127.0.0.1:6001 Admin: 127.0.0.1:6002

I've tried the above URLs and also these URLS:

172.20.10.2:6003 172.20.10.2:6001 172.20.10.2:6002

and each time mobile Safari says the server cannot be found. Can anyone advise?


Solution

  • The reason that Hoodie is not accessible from outside your computer is that Hoodie binds to the private 127.0.0.1address. You can overwrite that by setting the HOODIE_BIND_ADDRESS environment variable.

    On a Mac, it's as simple as HOODIE_BIND_ADDRESS=0.0.0.0 hoodie start, I'm not sure how the syntax is on windows