Domain showing fastAPI backend and not React frontend
hobbie71
FREEOP

6 months ago

Hey. I need some help.

I connect my repository and for some reason when I click on the domain i get the default {"message":"message","version":"0.1.0"} from the backend instead of the app I created using react and I have no idea why.

Git repository link:
https://github.com/hobbie71/MakeCode-Arcade-Sprite-Generator

I would appreciate the help. I will keep on looking for solutions online.

Thank you.

Solved$10 Bounty

Pinned Solution

6 months ago

The most I can suggest here is that you rebuild your entire project's structure. Consolidate your client to the client directory, and server to the server. Don't AI generate these files, find out what you actually need and try to build it yourself. That's the best way to get this working.

8 Replies

Railway
BOT

6 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


6 months ago

Hi,

It looks like the Dockerfile found in the root of your project serves the /server directory, which appears to be a Python API.

What are you looking for when you say "backend app created with React"?

Here's the link you can use to view the directly where that message is coming from: https://github.com/hobbie71/MakeCode-Arcade-Sprite-Generator/blob/ab4c075e40f43fcc875f0359d1e1838964e21dc6/server/app/main.py#L56


samgordon

Hi,It looks like the Dockerfile found in the root of your project serves the /server directory, which appears to be a Python API.What are you looking for when you say "backend app created with React"?Here's the link you can use to view the directly where that message is coming from: https://github.com/hobbie71/MakeCode-Arcade-Sprite-Generator/blob/ab4c075e40f43fcc875f0359d1e1838964e21dc6/server/app/main.py#L56

hobbie71
FREEOP

6 months ago

Hey loudbook,

Sorry for the confusion. I created a front end using React TSX and backend using FastAPI. When I click on automatically generated link, it seems like I'm only accessing the backend. When in reality, I need the link to open up the React App.

I'm sorry if my explanation is confusing. I'm confused myself, and I've been at this for a few hours.


hobbie71

Hey loudbook,Sorry for the confusion. I created a front end using React TSX and backend using FastAPI. When I click on automatically generated link, it seems like I'm only accessing the backend. When in reality, I need the link to open up the React App.I'm sorry if my explanation is confusing. I'm confused myself, and I've been at this for a few hours.

6 months ago

If you're looking to host both of these on Railway, you'll need two services. You can leave what you currently have to act as the backend, and create a new service to act as the front-end. You'll need to set the root directory to client in the service settings.

In terms of connecting to your backend, you'll just need to provide the GENERATE_PIXELLAB_IMAGE_API_URL which points directly to your Railway service's private domain as well as the port.


6 months ago

Sorry. There's more you'll have to do to get this to work.

Your package JSONs are nested. You should split up your projects properly, one in client, and one in server .

The easiest way to do this for you right now would be just moving the Dockerfile into server.


samgordon

Sorry. There's more you'll have to do to get this to work.Your package JSONs are nested. You should split up your projects properly, one in client, and one in server .The easiest way to do this for you right now would be just moving the Dockerfile into server.

hobbie71
FREEOP

6 months ago

Hello. I was actually think about that.

Also, I want to add separate env files because I'd need more than just the GENERATE_PIXELLAB_IMAGE_API_URL.

Then test everything before I do yet another commit and push. I'm just having a hard time.


6 months ago

The most I can suggest here is that you rebuild your entire project's structure. Consolidate your client to the client directory, and server to the server. Don't AI generate these files, find out what you actually need and try to build it yourself. That's the best way to get this working.


samgordon

The most I can suggest here is that you rebuild your entire project's structure. Consolidate your client to the client directory, and server to the server. Don't AI generate these files, find out what you actually need and try to build it yourself. That's the best way to get this working.

hobbie71
FREEOP

6 months ago

Hey loudbook. Thank you for the advice and the help. I went ahead and did that and made a lot more progress. Thank you again.


Status changed to Solved brody 6 months ago


Loading...