diff options
author | terminaldweller <thabogre@gmail.com> | 2022-06-03 14:48:38 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-06-03 14:48:38 +0000 |
commit | 6496bfe08c2c5bae024ae942ed743a5266b30e6d (patch) | |
tree | 542867a6236bc28362956bf307d96d1135335497 /src/main/java/com/terminaldweller/doc/DocController.java | |
parent | wip (diff) | |
download | mdrtl-6496bfe08c2c5bae024ae942ed743a5266b30e6d.tar.gz mdrtl-6496bfe08c2c5bae024ae942ed743a5266b30e6d.zip |
wip, the crud is working, now have to figure out how to update and save the actual text
Diffstat (limited to '')
-rw-r--r-- | src/main/java/com/terminaldweller/doc/DocController.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/terminaldweller/doc/DocController.java b/src/main/java/com/terminaldweller/doc/DocController.java index 39ddfe9..80e63a8 100644 --- a/src/main/java/com/terminaldweller/doc/DocController.java +++ b/src/main/java/com/terminaldweller/doc/DocController.java @@ -3,6 +3,7 @@ package com.terminaldweller.doc; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; /** The document controller class. */ @RestController +@CrossOrigin(origins = "https://localhost:7080") @RequestMapping(path = "api/v1/doc") public class DocController { private final DocService docService; @@ -29,10 +31,10 @@ public class DocController { return docService.getDocs(id); } - @PostMapping + @PostMapping(path = "{Id}") @ResponseStatus(HttpStatus.CREATED) - public void postDocs(@RequestBody Doc doc) { - docService.addNewDoc(doc); + public void postDocs(@PathVariable("Id") Long id, @RequestBody Doc doc) { + docService.addNewDoc(id, doc); } @DeleteMapping(path = "{Id}") |