Two web servers running in one IDX project

I’m curious to know if it’s possible to run two web servers in such a way that the front end can communicate with a backend. In my case, I have a LLama Index project with a Python backend and a NextJS front end. I am able to run the frontend with the default port=9000. However, when I try running the FastAPI server using the “Web-Host” syntax (API_SERVICE="https://$port-$WEB_HOST") suggested in this article: Project IDX troubleshooting & FAQ | Google for Developers, I’m unable to run the backend server.
I have tried running the backend on localhost:4000 and this works, but I can’t access the API endpoint from the frontend.
in summary, I’m wondering if it’s possible to have to URLs like:

  • frontend: https://9000-idx-test-run-llama-xxxx.cluster-yyy.cloudworkstations.dev/
  • backend: https://4000-idx-test-run-llama-xxxx.cluster-yyy.cloudworkstations.dev/<api-endpoint>

Hi @Mario_Hinojosa - when you look at the Backend Ports view, do you see both servers running?

@Mario_Hinojosa Please see our blog post that explains how to configure your frontend to talk to the backend: Full-stack development in Project IDX

@Vova @kirupa Hey guys, thanks a lot for your response. I can confirm I was able to achieve my objective of reaching my python backend through the JS frontend. Essentially, I had overlooked the fact that when I run my backend in localhost, a mapped URL is created that is accesible by the frontend.

1 Like