This README provides step-by-step instructions for running a Spring Boot application using Gradle Wrapper and testing it with a cURL client. The Spring Boot application in this example exposes an HTTP endpoint at http://localhost:8081/github/{username}/repos to fetch GitHub repositories for a given username.
Before you begin, make sure you have the following prerequisites installed on your system:
- Java Development Kit (JDK) 8 or higher
- Gradle Wrapper (included with the project)
- cURL command-line tool
-
Clone the repository:
git clone <repository_url> cd <project_directory>
-
Build the Spring Boot application using Gradle Wrapper:
./gradlew build #This command will download Gradle if necessary and build the project. -
Run the Spring Boot application:
./gradlew bootRun #This will start the Spring Boot application locally, and it will be accessible at http://localhost:8081. -
Run tests of Spring boot application
.\gradlew test
You can use cURL to test the endpoint by making HTTP GET requests. Replace with the GitHub username you want to query
curl -H "Accept: application/json" http://localhost:8081/github/<username>/repos