try to fix cors
This commit is contained in:
@@ -10,10 +10,10 @@ import java.util.Optional;
|
||||
import java.util.Vector;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
public class Routes {
|
||||
|
||||
@GetMapping("/posts/{longitude}/{latitude}")
|
||||
@CrossOrigin(origins = "*")
|
||||
public Vector<JodelPost> getPostsByLocation(@PathVariable("longitude") float longitude, @PathVariable("latitude") float latitude) {
|
||||
// list of all posts (not comments) in range
|
||||
Vector<JodelPost> posts = new Vector<>();
|
||||
@@ -121,6 +121,7 @@ public class Routes {
|
||||
}
|
||||
|
||||
@GetMapping("/post/{id}")
|
||||
@CrossOrigin(origins = "*")
|
||||
public JodelPost getPostByID(@PathVariable("id") long id) {
|
||||
// list of all posts (not comments) in range
|
||||
Optional<JodelPost> root_post = Optional.empty();
|
||||
@@ -226,6 +227,7 @@ public class Routes {
|
||||
}
|
||||
|
||||
@PostMapping("/posts")
|
||||
@CrossOrigin(origins = "*")
|
||||
public JodelPost postPost(@RequestBody JodelPost post) {
|
||||
// DB connection and statement
|
||||
Connection c;
|
||||
@@ -300,6 +302,7 @@ public class Routes {
|
||||
}
|
||||
|
||||
@DeleteMapping("/post/{id}")
|
||||
@CrossOrigin(origins = "*")
|
||||
public void deletePost(@PathVariable long id) {
|
||||
// DB connection and statement
|
||||
Connection c;
|
||||
|
||||
@@ -13,16 +13,4 @@ public class SwaJodelApplication {
|
||||
SpringApplication.run(SwaJodelApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedOrigins("*");
|
||||
registry.addMapping("/**").allowedOrigins("jodel.local.anxietyprime.de");
|
||||
registry.addMapping("/**").allowedOrigins("jodel.anxietyprime.de");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user