diff options
author | terminaldweller <thabogre@gmail.com> | 2022-06-09 17:06:28 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-06-09 17:06:28 +0000 |
commit | 907e4b96b27462d65c7e8599623e01e08099cf1b (patch) | |
tree | ffdcc3ebdf710cb729d65013984b637dca23a552 /src/main/java/com/terminaldweller/doc | |
parent | wip (diff) | |
download | mdrtl-907e4b96b27462d65c7e8599623e01e08099cf1b.tar.gz mdrtl-907e4b96b27462d65c7e8599623e01e08099cf1b.zip |
CORS fix
Diffstat (limited to '')
-rw-r--r-- | src/main/java/com/terminaldweller/doc/DocController.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/terminaldweller/doc/DocController.java b/src/main/java/com/terminaldweller/doc/DocController.java index f45ba52..a6a1734 100644 --- a/src/main/java/com/terminaldweller/doc/DocController.java +++ b/src/main/java/com/terminaldweller/doc/DocController.java @@ -16,7 +16,8 @@ import org.springframework.web.bind.annotation.RestController; /** The document controller class. */ @RestController -@CrossOrigin(origins = "https://localhost:7080, https://editor.terminaldweller.com") +// @CrossOrigin(origins = {"https://localhost:7080, https://editor.terminaldweller.com"}) +// @CrossOrigin(origins = "https://localhost:7080") @RequestMapping(path = "api/v1/doc") public class DocController { private final DocService docService; @@ -26,22 +27,26 @@ public class DocController { this.docService = docService; } + @CrossOrigin(origins = "https://localhost:7080") @GetMapping(path = "{Id}") public Optional<Doc> getDocs(@PathVariable("Id") Long id) { return docService.getDocs(id); } + @CrossOrigin(origins = "https://localhost:7080") @PostMapping(path = "{Id}") @ResponseStatus(HttpStatus.CREATED) public void postDocs(@PathVariable("Id") Long id, @RequestBody Doc doc) { docService.addNewDoc(id, doc); } + @CrossOrigin(origins = "https://localhost:7080") @DeleteMapping(path = "{Id}") public void deleteDocs(@PathVariable("Id") Long id) { docService.deleteDoc(id); } + @CrossOrigin(origins = "https://localhost:7080") @PutMapping(path = "{Id}") public void updatDoc(@RequestBody Doc doc, @PathVariable("Id") long id) { docService.updateDoc(doc, id); |