An open API service indexing awesome lists of open source software.

https://github.com/lahcenezzara/spring-boot-explorer

A simple Spring Boot project showcasing a "Hello World" endpoint with a friendly response. The project demonstrates the foundational structure of a Spring Boot web application, which can be expanded further.
https://github.com/lahcenezzara/spring-boot-explorer

api-development backend-development beginner-friendly hello-world java java-17 maven microservices openjdk rest-api rest-controller spring-boot spring-boot-example spring-boot-guide spring-boot-project spring-boot-starter spring-framework spring-tutorial spring-web web-application

Last synced: 11 months ago
JSON representation

A simple Spring Boot project showcasing a "Hello World" endpoint with a friendly response. The project demonstrates the foundational structure of a Spring Boot web application, which can be expanded further.

Awesome Lists containing this project

README

          

# Spring Boot Explorer

A simple Spring Boot application that demonstrates a "Hello World" endpoint with a customizable message. This project is designed to be beginner-friendly and serves as a foundation for exploring Spring Boot features.

---

## ๐Ÿš€ **Features**
- A RESTful `/hello` endpoint.
- Returns a friendly greeting message.
- Option to customize the greeting using a query parameter.

---

## ๐Ÿ› ๏ธ **Technologies Used**
- **Java 17** (OpenJDK)
- **Spring Boot** (Latest version)
- **Maven** (Build tool)
- **IntelliJ IDEA** (Development environment)

---

## ๐Ÿ“‚ **Project Structure**
```plaintext
src/main/java/com/lahcencodes/springbootexplorer/
โ”œโ”€โ”€ SpringBootExplorerApplication.java # Main application file
```

---

## ๐ŸŒ **Endpoints**

### **Hello Endpoint**
- **URL:** `http://localhost:8080/hello`
- **Method:** `GET`
- **Description:** Returns a greeting message.
- **Query Parameter:**
- `name` (optional): Customize the name in the greeting message.

#### Example Requests:
1. Default greeting:
```bash
curl http://localhost:8080/hello
```
**Response:**
```json
Hello World!
```

2. Custom greeting:
```bash
curl http://localhost:8080/hello?name=Lahcen
```
**Response:**
```json
Hello Lahcen!
```

---

## โšก **Getting Started**

### Prerequisites
Ensure you have the following installed:
1. **Java 17** (OpenJDK 17)
2. **Maven** (for building the project)
3. **Git** (for cloning the repository)

---

### **Steps to Run**

1. **Clone the Repository**
```bash
git clone https://github.com/LahcenEzzara/spring-boot-explorer.git
cd spring-boot-explorer
```

2. **Build the Application**
```bash
./mvnw clean install
```

3. **Run the Application**
```bash
./mvnw spring-boot:run
```

4. Open your browser or API testing tool and navigate to:
- [http://localhost:8080/hello](http://localhost:8080/hello)

---

## ๐Ÿงช **Testing the Application**

### Using `curl`
1. Default greeting:
```bash
curl http://localhost:8080/hello
```

2. Custom greeting:
```bash
curl http://localhost:8080/hello?name=LahcenCodes
```

### Using Postman
1. Create a new GET request.
2. Enter the URL: `http://localhost:8080/hello`.
3. Add a query parameter (optional): `name=LahcenCodes`.
4. Send the request.

---

## ๐Ÿ”ง **Stopping the Server**

1. **If running in the foreground**:
Press **`Ctrl + C`** to terminate the application.

2. **If running in the background**:
Find the process:
```bash
ps aux | grep java
```
Kill the process:
```bash
kill
```

---

## ๐Ÿ“œ **License**
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

## ๐Ÿ›ก๏ธ **Support**
If you have any questions or need help, feel free to contact me via [GitHub](https://github.com/LahcenEzzara).

Happy coding! ๐ŸŽ‰