# API Server Project
A simple User Management API that allows registering, authenticating, viewing, updating, and deleting users. It also includes a frontend UI using Thymeleaf or JSP templates.
| Field | Type | Description |
|---|---|---|
| id | int | Unique identifier (Primary Key) |
| name | string | Name of the user |
| username | string | Username (must be unique) |
| string | Email address (must be unique) | |
| password | string | Password |
- Method: GET
- URL:
/users/UI_Page - Description: Loads the HTML UI page for user management.
- Response: Renders the Thymeleaf or JSP template named
kp. - Usage: Visit in browser →
http://localhost:1012/users/UI_Page
Displays signup/login forms.
- Method: POST
- URL:
/users/signup - Description: Registers a new user.
- Response: Redirects to
kptemplate - Model Attributes:
message,user - Usage: Submit form from UI
Handles duplicate emails and shows error if any.
- Method: POST
- URL:
/users/login - Description: Authenticates a user.
- Response: Redirects to
kptemplate - Model Attributes:
message,user - Usage: Submit login form from UI
Shows welcome message on success.
- Method: GET
- URL:
/users - Description: Retrieves all users as JSON.
- Response: List of User objects
- Usage:
http://localhost:1012/usersvia Postman or browser
- Method: GET
- URL:
/users/{id} - Description: Retrieve a specific user
- Response: User JSON or 404
- Usage:
http://localhost:1012/users/1
- Method: PUT
- URL:
/users/{id} - Description: Update user details
- Response: Updated user or null if not found
- Usage: Send PUT request with user JSON
- Method: DELETE
- URL:
/users/{id} - Description: Delete a user by ID
- Response: 200 OK
- Usage: Send DELETE request
| Setting | Value |
|---|---|
| Allowed Origins | IPv4 address |
| Allowed Methods | GET, POST, PUT, DELETE |
| Allowed Headers | * |
| Allow Credentials | true |
| Endpoint | Method | Description | Response Type |
|---|---|---|---|
/users/UI_Page |
GET | Load UI page | HTML |
/users/signup |
POST | Register user | HTML + Model |
/users/login |
POST | Authenticate user | HTML + Model |
/users |
GET | List all users | JSON |
/users/{id} |
GET | Get user by ID | JSON |
/users/{id} |
PUT | Update user | JSON |
/users/{id} |
DELETE | Delete user | JSON (status) |
- Java
- Spring Boot
- Thymeleaf or JSP
- MySQL
- Maven
- JUnit 5
- Mockito
- Spring MVC Test (MockMvc)
- JaCoCo
- Signup and login (JSON & Form)
- User CRUD: Get, Create, Update, Delete
- Login validation
- Admin dashboard (optional frontend)
- Clone the repository
git clone https://github.com/tridha21/api-server-project.git
- Create your database
Make sure your MySQL service is running and the database is correctly configured in application.properties. - Run the server:
mvn spring-boot
mvn clean test
Test coverage was measured using JaCoCo, and tests were executed using Surefire (mvn test).
Unit tests were written using JUnit and Mockito to cover core business logic and service layer behavior.
API tests were executed using MockMvc inside Spring Boot and verified using Surefire.
Coverage was then analyzed using JaCoCo.

