feat(config): add CORS configuration for web access

This commit is contained in:
Jan K9f 2025-04-04 19:44:08 +02:00
parent 042f1db9f8
commit 404a518be0
Signed by: jank
GPG key ID: B9F475106B20F144

View file

@ -1,9 +1,12 @@
package de.szut.casino.config; package de.szut.casino.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer { public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") registry.addMapping("/**")
.allowedOrigins("http://localhost:4200", "http://192.168.176.120:4200") .allowedOrigins("http://localhost:4200", "http://192.168.176.120:4200")