I’m a begginer and have a tons os questions, but here is one that I need advice. I entered in a company that is building a program where the backend is build in Quarkus (java), and the front end in vuejs. My question is, as microservices, the two projects are done separatadely (diferent servers) with the vue consuming the endpoints of quarkus or they are done together? Explaining better with an example, in dev mode, one has to run in ex: “localhost:8080” and the other in ex: “localhost:8081”? or the both of them in the same port?
Forgive my english mistakes, thanks a lot.
Advertisement
Answer
There is usually three (at least) ways to do this, note that most of them are not Quarkus specific:
- You deploy your frontend in a webcontainer (httpd, nginx, node) and the Quarkus application separately. You access the Quarkus application via it’s URL, for this you’ll need CORS (Cross Origin Resource Sharing) configured.
- You deploy your frontend in a webcontainer and the Quarkus application separately, but you use the webcontainer to make a proxy to the Quarkus application to avoid having to configure CORS. In this case your frontend will be able to access your backend via localhost on the same port or a relative URL.
- You package your frontend application inside the Quarkus application (inside
META-INF/resources
) and your frondend access the backend via localhost on the same port or relative URL. The Quarkus application will serve your frontend resoures (HTML, CSS, JS, …)