Skip to content

Commit

Permalink
WebServerConfig more independent of FE routes
Browse files Browse the repository at this point in the history
  • Loading branch information
querwurzel committed Nov 11, 2023
1 parent 574173e commit 6a102e5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public void addCorsMappings(final CorsRegistry registry) {

/**
* This gives back control to the SPA (index.html) for paths/routes that are not served by the backend.
* The list of paths needs to be in sync with all routes in the SPA.
*/
@Bean
public RouterFunctionMapping indexRoute(@Value("static/index.html") final ClassPathResource indexHtml) {
Assert.isTrue(indexHtml.exists(), "index.html must exist");

var route = route(RequestPredicates
.method(HttpMethod.GET)
.and(path("/paste/**")),
.method(HttpMethod.GET)
.and(path("/assets/**").negate())
.and(path("/api/**").negate()),
request -> ok().contentType(MediaType.TEXT_HTML).bodyValue(indexHtml));

var routerFunctionMapping = new RouterFunctionMapping(route);
Expand Down

0 comments on commit 6a102e5

Please sign in to comment.