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
Solution:Jump to 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....
7 Replies
Project ID:
9440d80b-4d9a-4c44-940b-a961798f100c
9440d80b-4d9a-4c44-940b-a961798f100c
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
so, one port will be expose in per app deployment with docker file? right @ImLunaHey
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.
yup, now got the idea
thanks