Back

React Native +Appwrite Node client [ Granular Server Side Control]

  • 0
  • Tools
  • Web
D5
8 Dec, 2023, 10:43
TL;DR
When developing a React Native app with Expo, you can use your machine's local IP address as the hostname for your Appwrite project. This allows your connected phone to communicate with the Appwrite backend during development. To find your local IP address, you can use the ipconfig command on Windows or the ifconfig or ip addr commands on macOS or Linux. Once you have the IP address, set it as the hostname for your Appwrite project. If you encounter a CORS error, you can try using your PC's IP address instead of localhost. The Appwrite SDK is the recommended way to talk to the server functions, so additional libraries like
justice
8 Dec, 2023, 10:43

Opening exp://192.168.100.9:8081

on SM_M115F[phone name]

this is what I get as the name but then the configuration doe snot accept exp

D5
8 Dec, 2023, 10:44

localhost

D5
8 Dec, 2023, 10:44

What do you mean?

justice
8 Dec, 2023, 10:45

so that is the URL that comes when I start the expo server

justice
8 Dec, 2023, 10:45

I am insinuating that, its probably the hostname

justice
8 Dec, 2023, 10:46

this means that we dont need axios

justice
8 Dec, 2023, 10:46

we can talk to the server functions by using the sdk

D5
8 Dec, 2023, 10:46

Axios?

D5
8 Dec, 2023, 10:46

Yes

justice
8 Dec, 2023, 10:46

its an npm library like fetch web api

D5
8 Dec, 2023, 10:46

Appwrite is the full backend. You don't need something else. It includes everything to work with it

D5
8 Dec, 2023, 10:47

Not needed if you're using the SDK

justice
8 Dec, 2023, 10:47

what of this

justice
8 Dec, 2023, 10:47

this is very cool .. team did a good work then

D5
8 Dec, 2023, 10:48

Then instead of adding localhost in platforms section, you will need to add such IP

justice
8 Dec, 2023, 10:49

does it need the IP of the phone rendering the react native code or the PC

justice
8 Dec, 2023, 11:05

When working locally with Expo React Native, you're often using Expo's development server which typically runs on your local machine. The hostname you'd use for Appwrite when working with a locally connected phone would generally be your machine's local IP address.

You can usually find your machine's local IP address through your system settings or by running a command in your terminal or command prompt. For example, on Windows, you can use the ipconfig command, and on macOS or Linux, you can use ifconfig or ip addr commands.

Once you've obtained your local IP address, you can use that IP as the hostname when setting up your Appwrite project. For instance, if your local IP address is 192.168.1.10, you would set 192.168.1.10 as the hostname for your Appwrite project.

Remember, using your local IP as the hostname in your Appwrite project settings allows your Expo app running on a connected device to communicate with the Appwrite backend while in development mode.

justice
8 Dec, 2023, 11:05

from chatGPT

justice
8 Dec, 2023, 11:05

yet to try it .. then we can use it to help others

D5
8 Dec, 2023, 11:18

Not sure, maybe the phone

D5
8 Dec, 2023, 11:19

You could try and if it gives you a CORS error, you can try with the PC

justice
8 Dec, 2023, 11:29

what chatgpt is saying is that I need to use the IP of the pc and then because the phone is connected it would work

D5
8 Dec, 2023, 11:47

If you're accessing the PC through the phone, yes. If you're hosting it directly in the phone, then phone IP

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more