This example has a "Hello, World
" RESTful web service with Spring.
The service accepts HTTP GET requests at http://localhost:8080/greeting
.
It will respond with a JSON representation of a greeting, as the following listing shows:
{"id":1,"content":"Hello, World!"}
Spring Boot backend server
./gradlew bootRun
React Frontend server
cd src/react-frontend/
yarn install
# Option 1: to create a production build of the app and serve files on NodeJS server
yarn start
# Option 2: to start frontend client only
yarn start-client
The frontend server sends the index.html
file in response for the /
route, and Express.js serves all the files from the build folder generated by React.
Any requests to http://localhost:3000
with a slug, i.e. http://localhost:3000/goo123
would redirect to http://google.com
.