summaryrefslogtreecommitdiff
path: root/microservices/03-resource-server/src/main/java/com/example/resourceserver/post/PostRestController.java
blob: 1a3ce86e65e394f3e756cea9bbca2e2b7f0c9e8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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();
    }
}