This project is a simple web-based calculator built using Java and Spring Boot. It provides a REST API that allows users to perform basic arithmetic operations such as addition, subtraction, multiplication, and division.
The application is designed as a lightweight backend service for learning and practicing Spring Boot fundamentals, including REST controllers, request handling, and basic service structure.
Endpoint: /api/calc/add
curl -X POST "http://localhost:8080/api/calc/add" \
-H "Content-Type: application/json" \
-d '{"values":[1,2,3,4]}'Response (200):
{
"result": 10.0
}Endpoint: /api/calc/subtract
curl -X POST "http://localhost:8080/api/calc/subtract" \
-H "Content-Type: application/json" \
-d '{"values":[20,5]}'Response (200):
{
"result": 15
}Endpoint: /api/calc/divide
curl -X POST "http://localhost:8080/api/calc/divide" \
-H "Content-Type: application/json" \
-d '{"values":[50,2]}'Response (200):
{
"result": 25
}Endpoint: /api/calc/multiply
curl -X POST "http://localhost:8080/api/calc/multiply" \
-H "Content-Type: application/json" \
-d '{"values":[50,2,0]}'Response (200):
{
"result": 0
}[
{
"message": "At least one value is required."
}
][
{
"message": "Values must not contain zero."
}
]- Java
- Spring Boot
- Spring Boot DevTools
- Spring Web
- Validation