0

What would be the conventional way to write backend code in Expo? For example, have two directories - client and server at the root as below:

ROOT
|-Server
|   |_backend files here (ex.Express)
|
|-Client
|   |_frontend files here (Expo files)
|

If so, when I publish the project to Expo Go by running the command in the Client directory, how would Expo pick up my backend code in the Server directory?

My goal is to have the project on Expo Go connected to the backend.

peanutz
  • 346
  • 3
  • 6

2 Answers2

3

I am not familiar with Expo. But it sounds like Expo is only taking care of the client/app parts of a full stack application. In this case I would suggest to have two different repositories, one for the client/app and one for the backend.

Rias
  • 1,956
  • 22
  • 33
2

Since you're talking about using Express, which is a web server framework, you would basically never distribute this with the client app. It would be deployed separately, and called from the frontend over a network connection.

Having a separate backend, or server, allows you to make it a shared resource. Imagine a shopping app where you had to update the app each time you wanted to see new products - it wouldn't be practical. With a shared backend, you can have a centralized database, or a way to distribute content without updating the app each time, for example. This - commonly called client-server architecture - is the most common pattern in business development today.

This article on client-server architecture might be helpful. https://cio-wiki.org/wiki/Client_Server_Architecture

Abe
  • 4,500
  • 2
  • 11
  • 25