This project is a RESTful API for managing federal holidays for countries. Currently, it supports Canada and the USA, but it is designed to be easily extendable to other countries.
- Add a new holiday
- Update an existing holiday
- List holidays by country
- Java
- Spring Boot
- Spring Data JPA
- H2 Database (for simplicity)
- springdoc-openapi (for Swagger documentation)
- Java 11 or higher
- Maven
- Clone the repository:
git clone https://github.com/rahul7a/holidays.git
- Navigate to the project directory:
cd holidays
- Build the project using Maven:
mvn clean install
- Run the application:
mvn spring-boot:run
- URL:
/v1/holidays/{country}
- Method:
GET
- Description: Retrieve all holidays for a specific country.
- Response Example:
[ { "id": 1, "country": "USA", "name": "New Year Eve", "onDay": "2020-01-01" } ]
- URL:
/v1/holidays
- Method:
POST
- Description: Add a new holiday to the system.
- Request Body Example:
{ "country": "USA", "name": "Christmas", "onDay": "2020-12-25" }
- Response Example:
{ "id": 3, "country": "USA", "name": "Christmas", "onDay": "2020-12-25" }
- URL:
/v1/holidays/{id}
- Method:
PUT
- Description: Update the details of an existing holiday.
- Request Body Example:
{ "country": "USA", "name": "Christmas", "onDay": "2024-12-26" }
- Response Example:
{ "id": 3, "country": "USA", "name": "Christmas", "onDay": "2024-12-26" }
The API documentation is available through Swagger. You can access it at: http://localhost:8085/swagger-ui/index.html
To run the tests for the application, use the following Maven command: mvn test