Compare commits

..

2 Commits

Author SHA1 Message Date
f9cb798dd8 React app prod updates 2023-12-01 22:32:51 +01:00
2a3248435c SpringBoot serving React
* build React release bundle
  npm run build
* copy build directory to backend/src/main/resources/static
* enjoy husle free deployment
2023-12-01 21:24:36 +01:00
8 changed files with 38 additions and 16 deletions

8
.gitignore vendored
View File

@ -35,3 +35,11 @@ out/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
### React (prod build) static files ###
backend/src/main/resources/static/asset-manifest.json
backend/src/main/resources/static/favicon.ico
backend/src/main/resources/static/index.html
backend/src/main/resources/static/manifest.json
backend/src/main/resources/static/robots.txt
backend/src/main/resources/static/static/*

View File

@ -0,0 +1,20 @@
package djmil.cordacheckers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import jakarta.servlet.http.HttpServletRequest;
@Controller
public class ReactAppController {
// This controller simply redirects all UI related routes
// to index.html, allowing react and react-router to work its magic
@GetMapping(value = { "/", "/games/*","/about","/leaderboard" })
@PutMapping("/error")
public String getIndex(HttpServletRequest inRequest) {
return "/index.html";
}
}

View File

@ -9,3 +9,5 @@ corda.root.passw=admin
corda.client.maxPollAttempts=30 corda.client.maxPollAttempts=30
server.port=8081 server.port=8081
#logging.level.org.springframework.web=DEBUG

View File

@ -13,6 +13,9 @@
"react-scripts": "^5.0.1", "react-scripts": "^5.0.1",
"web-vitals": "^3.5.0" "web-vitals": "^3.5.0"
}, },
"optionalDependencies": {
"fsevents": "^2.x.x"
},
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
@ -22,8 +25,7 @@
"proxy": "http://localhost:8081", "proxy": "http://localhost:8081",
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"react-app", "react-app"
"react-app/jest"
] ]
}, },
"browserslist": { "browserslist": {

View File

@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>Corda Chechers</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -1,21 +1,11 @@
{ {
"short_name": "React App", "short_name": "Checkers",
"name": "Create React App Sample", "name": "Corda Checkers",
"icons": [ "icons": [
{ {
"src": "favicon.ico", "src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16", "sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon" "type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
} }
], ],
"start_url": ".", "start_url": ".",