I have a Spring Boot application working with Spring Data Rest. I have a domain entity Post which has a @OneToMany relationship to a domain entity Comment. For both entities I created a Repository interface.
So far, I have one controller called PostController which handles both entites. Via http://localhost:8080/posts/1/ I get the post with Id 1. In addition, via http://localhost:8080/posts/1/comments I get all comments on the post with Id 1.
I wonder whether this is the right approach with a single controller for both entites or if I should write a single controller for each of the Post and Comments entities?