This example project shows how to integrate a React application inside a Vert.x application.
It is a multi-project build with one project for the Vert.x application and one project for the React one.
It builds the React application thanks to the react-script
package. The React project was generated by create-react-app
.
It bundles the React application as a jar in the webroot
subdirectory that Vert.x serves as static resources (as configured in the MainVerticle
).
The default React output directory (build
) was changed to build/webapp/webroot
and the build/webapp
directory was added to the Java resources.
A selenium based test ensures that the React application is served by Vert.x as expected.
It uses the globally installed Node.js. It also uses yarn.
gradle build
gradle run
Open http://localhost:8888.