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