π How to Use β Spring Boot Blogging Application This guide explains how to test all APIs using Swagger UI with JWT Authentication.
1οΈβ£ Open Swagger UI Go to your deployed Swagger UI link: Swagger UI
2οΈβ£ Register a New User Expand /api/auth/register endpoint.
Click Try it out.
Fill the request body:
json { "name": "John Doe", "email": "johndoe@example.com", "password": "yourpassword" } Execute and confirm success.
3οΈβ£ Login to Get JWT Token Expand /api/auth/login.
Provide:
json { "username": "johndoe@example.com", "password": "yourpassword" } Click Execute β Copy the token from response.
4οΈβ£ Authorize Swagger with JWT Click Authorize (top-right green button).
In the value field, paste:
php-template Bearer <your_token_here> Click Authorize β Close.
5οΈβ£ Test the APIs Once authorized, you can:
Users Controller β View and manage users.
Posts Controller β Create, read, update, delete posts.
Category Controller β Manage blog categories.
Comments Controller β Add or delete comments.
SavePost Controller β Save posts for a user.
Upload Post Image β Upload images for posts.
6οΈβ£ Entity Relationships Refer to the diagram in the ApplicationPreview folder to understand:
User β Post β Comment relationships
Category linking with posts
Saved Posts mapping
7οΈβ£ Notes
-> Token expires after a set time β re-login if required. -> Only authorized users can create/update/delete posts or comments.
π Related Links
GitHub Repo: https://github.com/NikStack20/JAVA-Spring-Boot-Project
License: Apache License 2.0