From 49dcd38ab32bf51de78a0937e899d6d62f2a6d29 Mon Sep 17 00:00:00 2001 From: djmil Date: Sat, 2 Dec 2023 01:24:19 +0100 Subject: [PATCH] different reactappcontroller mapping --- .../djmil/cordacheckers/ReactAppController.java | 8 ++++---- webapp/public/index.html | 2 +- webapp/src/container/Games.jsx | 14 ++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/djmil/cordacheckers/ReactAppController.java b/backend/src/main/java/djmil/cordacheckers/ReactAppController.java index 5cfc464..5d53593 100644 --- a/backend/src/main/java/djmil/cordacheckers/ReactAppController.java +++ b/backend/src/main/java/djmil/cordacheckers/ReactAppController.java @@ -1,8 +1,7 @@ package djmil.cordacheckers; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; import jakarta.servlet.http.HttpServletRequest; @@ -11,8 +10,9 @@ 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", "/games/*", "/about","/leaderboard" }) - @PutMapping("/error") + // @GetMapping(value = { "", "/", "/games", "/games/*", "/about","/leaderboard" }) + // @PutMapping("/error") + @RequestMapping(value = { "/", "/{x:[\\w\\-]+}", "/{x:^(?!api$).*$}/*/{y:[\\w\\-]+}","/error" }) public String getIndex(HttpServletRequest inRequest) { return "/index.html"; } diff --git a/webapp/public/index.html b/webapp/public/index.html index ec6e3d2..4cb1350 100644 --- a/webapp/public/index.html +++ b/webapp/public/index.html @@ -9,7 +9,7 @@ name="description" content="Web site created using create-react-app" /> - +