This application serves to fetch data from public API - JSON Placeholder.
- Application fetches data from the API and sends the results to the client.
- Application has 2 controllers with corresponding endpoints:
- Root endpoint is
http://localhost:8080/
-
CommentController
- in methodgetComments
usesApiService
to fetchComment
data.- Endpoint
/comments
- Endpoint
-
PostController
- identically toCommentController
usesApiService
to fetchPost
data from external API.- Endpoint
/posts
- Endpoint
ApiService
class internally usesHttpClient
to executeGET
request by endpointhttps://jsonplaceholder.typicode.com/comments
andhttps://jsonplaceholder.typicode.com/posts
forCommentController
andPostController
respectively.
- Download and Install Maven
- Download the source code
- Open the source code in your IDE and run
PostsApplication
class which is located insrc/main/java/com/dev/postsapp/
- In order to render the data on the client side - please proceed with frontend part setup, if you did not do it yet.