SpringBoot serving React

* build React release bundle
  npm run build
* copy build directory to backend/src/main/resources/static
* enjoy husle free deployment
This commit is contained in:
djmil 2023-12-01 21:24:36 +01:00
parent dc3fd61bd3
commit 2a3248435c
2 changed files with 23 additions and 1 deletions

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

@ -8,4 +8,6 @@ corda.root.login=admin
corda.root.passw=admin
corda.client.maxPollAttempts=30
server.port=8081
server.port=8081
#logging.level.org.springframework.web=DEBUG