Implementing POST Service to Create a Post for a User
In this section, we will enable post-operation to create a post for the specific user.
Step 1: Open the UserJPAResource.java file and create a PostMapping to create a post.
Step 2: Create a post repository.
Step 3: Open the Postman and send a POST request with the URI http://localhost:8080/jpa/users/102/posts. Under the Body tab, insert the post description.
It returns the Status: 201 Created. We can also see this post in the database by executing the query select *from post;