Skip to content

Latest commit

Β 

History

History
77 lines (50 loc) Β· 1.57 KB

File metadata and controls

77 lines (50 loc) Β· 1.57 KB

πŸ›  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