-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backend: Adds feature when backend serves frontend (#3)
To keep the system simple and not to have nodejs running in the same image or a separate image for frontend. Backend will serve static files and redirect game ids to the index.html
- Loading branch information
Showing
5 changed files
with
11 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Frontend build ### | ||
backend/src/main/resources/static/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
package io.zakh.tri | ||
|
||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc | ||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer | ||
|
||
@Configuration | ||
@EnableWebMvc | ||
class WebConfig : WebMvcConfigurer { | ||
override fun addCorsMappings(registry: CorsRegistry) { | ||
|
||
registry.addMapping("/**") | ||
.allowedOrigins("http://localhost:5173", "http://localhost:4000") | ||
.allowCredentials(true) | ||
.allowedMethods("*") | ||
override fun addViewControllers(registry: ViewControllerRegistry) { | ||
registry.addViewController("/{gameID:\\w*}") | ||
.setViewName("index.html") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters