package com.example.config;

import org.springframework.context.annotation.Configuration;

@Configuration
public class CorsConfig {
	  @Bean
	    public WebMvcConfigurer corsConfigurer() {
	        return new WebMvcConfigurer() {
	            @Override
	            public void addCorsMappings(CorsRegistry registry) {
	                registry.addMapping("/**") // alle Endpoints
	                        .allowedOrigins("http://localhost:4200") // Angular Frontend
	                        .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
	                        .allowedHeaders("*")
	                        .allowCredentials(true);
	            }
	        };
	    }

}
