This is a Spring Boot application that uses the GitHub API to explore repositories of a given user. The endpoint returns a list of non-forked repositories of the user along with their branches and last commit SHA.
- Java
- Spring Boot
- Gradle
- Clone the repository.
- Navigate to the project directory.
- Update the
application.propertiesfile with your GitHub token.
GITHUB_TOKEN=<your_token>- Build the project using the following command:
./gradlew build- Run the project using the following command:
./gradlew bootRunUse any rest client to make a GET request to the following endpoint:
http://localhost:8080/api/explore/{username}
Replace {username} with the GitHub username you want to explore.
Set the Accept header to application/json to receive the response, otherwise you will receive a 415 Unsupported Media Type error.
Accept: application/json
To run the tests, use the following command:
./gradlew testGET /api/explore/jcembala
Accept: application/json
[
{
"name": "git-repo-explorer",
"owner": {
"login": "JCembala"
},
"branches": [
{
"name": "master",
"lastCommitSha": "2d0342e39c997dd38f5fe7195d17961d8fb2fbe8"
}
]
}
]