Accessing backend endpoints but unable to access frontend code after successful deployment

I deployed a Nestjs and Angular app in Railway.app via dockerfile. My problem is after deploying the app successfully, I'm getting access the backend's endpoints but can't access any frontend part code. I used nx monorepo where my Backend running on port 3000 via PM2 and frontend running 5173 via Vite. Can you please help me on this? Or am I missing some configuration related things. TIA Here is an demo URL for backend https://fullstack-app-production.up.railway.app/api/products In that link I'm successfully getting product response. Now, How can I get the frontend which is running in port 5173 ? I tried with https://fullstack-app-production.up.railway.app:5173 but it doesn't work at cryingman
Solution:
yes the single random port they provide via the PORT env. Which currently sounds like your backend is using. to get the frontend working it'll need to be deployed as a seperate service....
Jump to solution
7 Replies
Percy
Percy2y ago
Project ID: 9440d80b-4d9a-4c44-940b-a961798f100c
.theanam
.theanamOP2y ago
9440d80b-4d9a-4c44-940b-a961798f100c
luna
luna2y ago
the issue is likely you need to split your app, you cannot run both of them in the same service. Only the port from env.PORT is exposed for a single service. https://docs.railway.app/deploy/exposing-your-app
.theanam
.theanamOP2y ago
so, one port will be expose in per app deployment with docker file? right @ImLunaHey
Solution
luna
luna2y ago
yes the single random port they provide via the PORT env. Which currently sounds like your backend is using. to get the frontend working it'll need to be deployed as a seperate service.
.theanam
.theanamOP2y ago
yup, now got the idea thanks
luna
luna2y ago
Want results from more Discord servers?
Add your server