1
|
package cz.zcu.kiv.backendapi.config;
|
2
|
|
3
|
import org.springframework.context.annotation.Configuration;
|
4
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
5
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
6
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
7
|
|
8
|
// TODO this needs to be configured for production and localhost development!
|
9
|
@Configuration
|
10
|
@EnableWebMvc
|
11
|
public class CorsConfig implements WebMvcConfigurer {
|
12
|
|
13
|
@Override
|
14
|
public void addCorsMappings(CorsRegistry registry) {
|
15
|
registry.addMapping("/**")
|
16
|
.allowedOrigins("*")
|
17
|
.allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH");
|
18
|
}
|
19
|
}
|