https://github.com/ruferdz/simple-calculator
🛠️ This project implements a simple calculator API using Spring Boot, providing endpoints for basic arithmetic operations, string concatenation, exponentiation, and mathematical functions. 🔢✨ Check it out: Technical Report ⬇️⬇️⬇️
https://github.com/ruferdz/simple-calculator
azure devops jenkins spring-boot
Last synced: 24 days ago
JSON representation
🛠️ This project implements a simple calculator API using Spring Boot, providing endpoints for basic arithmetic operations, string concatenation, exponentiation, and mathematical functions. 🔢✨ Check it out: Technical Report ⬇️⬇️⬇️
- Host: GitHub
- URL: https://github.com/ruferdz/simple-calculator
- Owner: RuFerdZ
- Created: 2024-01-17T08:04:20.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-05T15:15:58.000Z (about 2 years ago)
- Last Synced: 2025-01-20T06:14:52.082Z (over 1 year ago)
- Topics: azure, devops, jenkins, spring-boot
- Language: HTML
- Homepage: https://drive.google.com/drive/folders/1iPApm64tJi_DasmMHUlFPXXBN3IiTtoy?usp=sharing
- Size: 1.32 MB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Calculator API 💻
This project implements a simple calculator API using Spring Boot. It provides endpoints for performing basic arithmetic operations, string concatenation, exponentiation, and mathematical functions.
## Endpoints (Documentation) 📝
## Arithmetic Operations ➕➖✖️➗
| Endpoint | Description | Request Parameters | Return Type |
|----------------------|-------------------------------------------------|---------------------------|-------------|
| `/calc/add` | Adds two integers | `a` (int), `b` (int) | `int` |
| `/calc/subtract` | Subtracts one integer from another | `a` (int), `b` (int) | `int` |
| `/calc/multiply` | Multiplies two integers | `a` (int), `b` (int) | `int` |
| `/calc/divide` | Divides one integer by another (handles division by zero) | `a` (int), `b` (int) | `int` |
| `/calc/remainder` | Calculates the remainder of dividing one integer by another | `a` (int), `b` (int) | `int` |
**Note:** The `/calc/divide` endpoint gracefully handles division by zero, returning a suitable error message.
## String Manipulation 🔤
| Endpoint | Description | Request Parameters | Return Type |
|----------------------|-------------------------------------------------|---------------------------|-------------|
| `/calc/concat` | Concatenates two strings | `a` (String), `b` (String)| `String` |
## Mathematical Functions 🧮
| Endpoint | Description | Request Parameters | Return Type |
|----------------------|-------------------------------------------------|---------------------------|-------------|
| `/calc/power` | Calculates `a` raised to the power of `b` (handles negative powers) | `a` (double), `b` (double) | `long` |
| `/calc/square` | Calculates the square of a number | `a` (double) | `long` |
| `/calc/sqrt` | Calculates the square root of a number | `a` (double) | `double` |
| `/calc/log` | Calculates the natural logarithm (base e) of a number | `a` (double) | `double` |
**Note:** The `/calc/power` endpoint can handle negative powers.
**Note:**
- The `/calc/divide` endpoint handles division by zero gracefully, returning a suitable error message.
- The `/calc/power` endpoint can handle negative powers.
## Environments 🌐
This project supports three environments: development (dev), staging, and production. The base URL for each environment will vary depending on your deployment setup. You'll need to replace `[BASE_URL]` in the links below with the appropriate values.
## Postman Collection 📦
A Postman collection for testing these endpoints across all environments is available at [link to Postman collection] (link not provided for security reasons). However, you can easily create your own collection using the information provided in the "Endpoints (Documentation)" table.
## Environment Links 🔗
- Development: `[BASE_URL]/calc`
- Staging: `[BASE_URL]/calc`
- Production: `[BASE_URL]/calc`
## Building and Running 🏃♂️
1. Clone this repository.
2. Ensure you have Gradle installed.
3. Run `gradle build` to build the project.
4. Start the application using your preferred method (e.g., Spring Boot application runner).
## Running with Docker 🐳
To run the Spring Boot Calculator API using Docker, follow these steps:
1. Install Docker on your machine by following the instructions on the official Docker website: [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
2. Build the Docker image using the provided Dockerfile:
docker build -t calculator-api .
3. Once the image is built, you can run the container:
docker run -p 8080:8080 calculator-api
The API will be accessible at `http://localhost:8080`.