From aa122113ade36f02dc8fdbebdf1232b5c4b8742c Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Fri, 3 Jul 2026 19:02:36 +0530 Subject: Microservice sample projects --- .../resourceserver/post/PostRestController.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java (limited to 'microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java') 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 getAll() { + return postService.findAll(); + } +} -- cgit v1.2.3