Projekt

Obecné

Profil

Stáhnout (815 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
package cz.zcu.kiv.backendapi.config;
2

    
3
import org.springframework.context.annotation.Configuration;
4
import org.springframework.http.HttpMethod;
5
import org.springframework.web.servlet.config.annotation.CorsRegistry;
6
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
7
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8

    
9
/**
10
 * Configuration class for CORS
11
 */
12
@Configuration
13
@EnableWebMvc
14
public class CorsConfig implements WebMvcConfigurer {
15

    
16
    @Override
17
    public void addCorsMappings(CorsRegistry registry) {
18
        registry.addMapping("/**")
19
                .allowedOrigins("*")
20
                .allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name(),
21
                        HttpMethod.PUT.name(), HttpMethod.PATCH.name());
22
    }
23
}
    (1-1/1)