Alejo Conejo
Alejo Conejo

Reputation: 43

Vaadin application and react in the same server

I'm a bit confused about what server to use for contain both, a Vaadin application (java) and a react application. I was using nodejs for contain my react app, now I developed my vaadin application (I've used jetty to test it out), but I want to combined them in the same server

  1. Can I use Tomcat to contain both? How can I deploy React on Tomcat?
  2. Can I use expressJs to contain both? How can I deploy Vaadin on expressJs?
  3. Is there a better approach?

Thank you a lot.

Upvotes: 1

Views: 625

Answers (1)

Leif Åstrand
Leif Åstrand

Reputation: 8001

You're to some degree comparing apples to oranges in this case. To directly answer you question: You can use Tomcat for both, but not Express.js.

  • Vaadin is an opinionated full stack framework. It explicitly covers both the part of the UI that runs on the server and the part that runs in the browser. The server part only works on the JVM, either through a servlet container such as Tomcat or deployed as a standalone process with an embedded servlet container using e.g. Spring Boot.
  • React a relatively agnostic client-side framework - it is explicitly designed to work with any server-side technology. It is often used together with server-side JavaScript (e.g. Express.js) because that allows the whole application to be implemented using only one language, but it is also very commonly used with a backend running with e.g. Java or C#. All you need on the server is a way of creating endpoints for accessing the backend logic. In the case of Java, the two most common solution nowadays is to do REST endpoints using Spring (either MVC or WebFlux) or JAX-RS (e.g. Jersey).

Upvotes: 3

Related Questions