Overview
In the post, we are going to create a simple Spring server application with Gradle build system with React frontend.
Hello World server application
Firstly, we are going to create a simple Java server application.
We use Spring initializr project to create a simple Spring application with Spring Web dependency.
We use Kotlin as a language and Gradle as a build system for the project.
Hello World frontend application
Secondly, we are going to create a simple React frontend application.
To accomplish it do the following steps:
- Install https://nodejs.org/en/
- Run the following script in the root folder of a project:
1
npx create-react-app <app-name>
- Run the following script in the
folder to check it:
1
npm start
- Build the React app with the following command:
1
npm run build
-
Put the result of it from the build folder into resources/static folder of the Spring boot application.
-
Run the spring boot application and check the result.
Conclusion
We have created a simple Spring server application with React frontend. You could check out the source code here.
-
Previous
How to deploy a java docker app with a database into the cloud -
Next
How to use GitHub Actions