diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-07-03 19:02:36 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-07-03 19:02:36 +0530 |
| commit | aa122113ade36f02dc8fdbebdf1232b5c4b8742c (patch) | |
| tree | c345b83db6c769bf5e72a09e3f19d43431961695 /microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java | |
| parent | b221a83ecef1dd7f9583d5107017d24e668205a6 (diff) | |
Microservice sample projects
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(); + } +} |
