This Fibonacci service provides a RESTful API endpoint to calculate Fibonacci numbers.
- Java Development Kit (JDK) installed
- Maven build tool installed
- Docker installed (optional, for containerization)
-
Clone this repository:
git clone <repository_url>
-
Navigate to the project directory:
cd fibonacci-api
-
Build the project using Maven:
mvn clean install
-
Run the application:
java -jar target/fibonacci-api-0.0.1-SNAPSHOT.jar
The service will start running on
http://localhost:8080
.
To calculate the Fibonacci number for a given n
, make a GET request to the /fib
endpoint with the n
query parameter.
Example request:
GET /fib?n=10
Example response:
55
You can also run the Fibonacci service using Docker. After building the project with Maven, create a Docker image:
docker build -t fibonacci-api .
Then run the Docker container:
docker run -p 8080:8080 fibonacci-service
The service will be accessible on http://localhost:8080.
This project is licensed under the MIT License.