A REST API for a blog built with Spring Boot and Java. PostgreSQL is used as the database to store the blog posts and the comments to a post.
The two entities are:
-
post
entity with attributes -i.
id
ii.
title
iii.
content
-
comment
entity with attributes -i.
id
ii.
post_id
iii.
message
The endpoints for posts are:
- POST : /posts - Add a new blog post.
- GET : /posts - Get all the blog posts.
- GET : /posts/id - Get a blog post by id.
- PUT : /posts/id - Updates a blog post with the given id.
- DELETE : /posts/id - Delete a blog post with given id.
The endpoints for comments are:
- POST : /posts/postid/comments - Adds a new comment to a blog post with given id.
- GET : /posts/postid/comments - Get all the comments of a blog post with given id.
- PUT : /posts/postid/comments - Updates the comment to a blog post with given id.
- DELETE : /posts/postid/comments/id - Deletes the comment to a blog post with given id.
Postman Collection: https://api.postman.com/collections/17404613-7f51f8b7-5dd4-4958-adc4-47ec686f4db9?access_key=PMAT-01H6DSK8CSMQMHT41A19SQMY5K