This service provides an interface to fetch the most popular repositories from GitHub based on various filters such as creation date and programming language. It retrieves repositories sorted by the number of stars, and users can request the top 10, 50, 100, etc., repositories.
- Prerequisites
- Installation
- Running the Application
- Running Tests
- Assumptions and Default Values
- API Usage
-
Java JDK 17: Ensure you have Java 17 installed.
-
Maven Wrapper: The project includes the Maven Wrapper, so you don't need a local Maven installation. We'll use
./mvnw
to execute Maven-related commands.
-
Clone the Repository:
git clone https://github.com/kenshinji/GitHubRepo.git
-
Install Dependencies:
./mvnw install
Execute the following Maven command:
./mvnw spring-boot:run
After running the above command, the application will start and be accessible at http://localhost:8080.
To execute the tests, run the following command:
./mvnw test
While building this service, certain assumptions were made regarding input parameters to ensure a smooth user experience. They are as follows:
- Date Parameter (date):
If the user does not provide a specific date when querying for popular repositories, the service assumes the user is interested in repositories created as of the current date. For instance, if querying on October 10th, 2023 without specifying a date, the service will default to considering repositories created on 2023-10-10.
- Top Repositories Parameter (count):
The service returns a list of the most popular repositories, sorted by number of stars. If the user does not specify how many repositories they want (e.g., top 10, 50, 100), the service defaults to returning the top 10 repositories. This ensures that even if the user is unsure about the exact number of repositories they want to view, they will still get a concise list of the most popular ones.
Use the endpoint /top-repositories with optional query parameters:
- date (format: YYYY-MM-DD): Filter repositories based on creation date.
- count: Number of top repositories you want to fetch (e.g., 10, 50, 100).
- language: Filter repositories based on programming language. Example:
To fetch the top 50 Java repositories since 2023-01-01:
http://localhost:8080/top-repositories?date=2023-01-01&count=50&language=Java