diff options
Diffstat (limited to 'microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java')
| -rw-r--r-- | microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java b/microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java new file mode 100644 index 0000000..1a3ce86 --- /dev/null +++ b/microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java @@ -0,0 +1,22 @@ +package com.example.resourceserver.post; + +import java.util.List; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/posts") +public class PostRestController { + private PostService postService; + + public PostRestController(PostService postService) { + this.postService = postService; + } + + @GetMapping("") + public List<Post> getAll() { + return postService.findAll(); + } +} |
