This is an example project that combines spring-boot and create-react-app.
The project can be downloaded and run immediately using the IDE. If you want to change the root folder, please change the project name in the files 'settings.gradle' and '.project'.
The location of the react project is as follows.
Spring-With-React-Project\src\main\resources\frontend
I've set the path so that the results of building the React app are reflected directly in the spring boot. You can simply apply the changes to the spring boot with the commands below.
cd Spring-With-React-Project\src\main\resources\frontend npm run build
After you first download the project, if you want to build a reactant, you must proceed with the command below in advance.
cd Spring-With-React-Project\src\main\resources\frontend npm install
이 프로젝트는 스프링-부트와 create-react-app를 결합시켜놓은 예제 프로젝트입니다.
해당 프로젝트는 다운로드 후, IDE를 사용해 바로 실행시킬 수 있게 되어 있습니다. 루트 폴더를 바꾸고 싶다면 'settings.gradle', '.project' 파일 내의 프로젝트 명을 함께 바꿔주시기 바랍니다.
리액트 프로젝트의 위치는 아래와 같습니다.
Spring-With-React-Project\src\main\resources\frontend
리액트 앱을 빌드한 결과물이 스프링 부트에 바로 반영되도록 경로를 설정해놓았습니다. 아래의 명령어로 간단하게 변경사항을 스프링 부트에 적용할 수 있습니다.
cd Spring-With-React-Project\src\main\resources\frontend npm run build
처음 프로젝트를 내려받은 뒤에, 리액트를 빌드하고 싶다면 아래의 명령어를 사전에 진행해줘야합니다.
cd Spring-With-React-Project\src\main\resources\frontend npm install