diff options
Diffstat (limited to 'src/main/java/com/encora/Main.java')
-rw-r--r-- | src/main/java/com/encora/Main.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/com/encora/Main.java b/src/main/java/com/encora/Main.java index ac2a609..14026af 100644 --- a/src/main/java/com/encora/Main.java +++ b/src/main/java/com/encora/Main.java @@ -2,9 +2,12 @@ package com.encora; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.data.domain.Sort; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.Date; import java.util.List; @@ -14,6 +17,17 @@ import java.util.Objects; @RestController @RequestMapping("v1") public class Main { + @Bean + public WebMvcConfigurer corsConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedOrigins("*"); + } + }; + } + + private final ToDosRepository toDosRepository; public Main(ToDosRepository toDosRepository) { |