Coverage Summary for Class: WebConfig (dev.karlkadak.backend.config)
Class |
Method, %
|
Line, %
|
WebConfig |
100%
(2/2)
|
100%
(2/2)
|
WebConfig$$SpringCGLIB$$0 |
WebConfig$$SpringCGLIB$$FastClass$$0 |
WebConfig$$SpringCGLIB$$FastClass$$1 |
WebConfig$1 |
100%
(2/2)
|
100%
(6/6)
|
Total |
100%
(4/4)
|
100%
(8/8)
|
package dev.karlkadak.backend.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Configuration class to set up global CORS settings, ensures the backend application allows cross-origin requests from
* the React frontend
*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000").
allowedMethods("GET", "POST", "DELETE")
.allowedHeaders("*")
.allowCredentials(true);
}
};
}
}