Hi, I've deployed two stuff on railway, the first one is ruby on rail that serve as backend api and websocket cable connection server, and the other hand is react + vite as frontend app. The first one is successfully deployed. but the react + vite app is not. The first thing I did is just like you, straight adding the project right outta the github repo, but it gives me error the first time, caused by that is the deploy command is empty. Then, I try some work around like npm run dev, run serve, or run preview, those command work well on the railway, but it gives port 5173 and host 'localhost'. how can i access my frontend app? it doesn't show on generated domain. thx
I've deployed my backend successfully on Railway. Now I want to do the same with my React/Vite frontend. The difference with this video, is that you have to specify the build command (npm run build), but also a start command. I don't know what to put on a start command. Previously the frontend was on Render, I just had to specify the directory (so, /dist).
This might the issue for you "start": "npx http-server ./dist", But the problem.. the content is not served in this case. I copied it from the frontend repo package.json
You need to configure caddy. search for "react vite deployment in railway" in google. Install that given repo and copy the caddy file and cady.toml file from that example repo to your repo
Hi, I've deployed two stuff on railway, the first one is ruby on rail that serve as backend api and websocket cable connection server, and the other hand is react + vite as frontend app. The first one is successfully deployed. but the react + vite app is not. The first thing I did is just like you, straight adding the project right outta the github repo, but it gives me error the first time, caused by that is the deploy command is empty. Then, I try some work around like npm run dev, run serve, or run preview, those command work well on the railway, but it gives port 5173 and host 'localhost'. how can i access my frontend app? it doesn't show on generated domain. thx
If you have Mongodb or PostgreSQL database. Then where do you prefer database to host ?
I have the same question.
I've deployed my backend successfully on Railway. Now I want to do the same with my React/Vite frontend. The difference with this video, is that you have to specify the build command (npm run build), but also a start command. I don't know what to put on a start command. Previously the frontend was on Render, I just had to specify the directory (so, /dist).
Hey bud did you get around the issue
This might the issue for you
"start": "npx http-server ./dist",
But the problem.. the content is not served in this case. I copied it from the frontend repo package.json
I have the same problem.. Did you find a solution?
You need to configure caddy.
search for "react vite deployment in railway" in google. Install that given repo and copy the caddy file and cady.toml file from that example repo to your repo
same thins
Great video man, thanks!
What does it mean if your Express API works perfectly on localhost but when you deploy to Railway it gives the error
""Cannot GET /read"?
It means server is running get on that api end point is not fetching anything . Add proper route to the end point
terimakasih informasinya bang