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

https://github.com/destrutoyt/spring-rest-demo


https://github.com/destrutoyt/spring-rest-demo

api-rest crud java mysql postman rest-api spring spring-boot

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# Spring REST API Demo

This project demonstrates how to design and build **RESTful APIs** with the **Spring Framework**.
It connects to a **MySQL database**, retrieves and manipulates data, converts it into **JSON**, and exposes it through REST endpoints that can be consumed by web applications or other clients.

The application showcases key backend development skills, including:
- ๐Ÿš€ **Building REST APIs with Spring Boot**
- ๐Ÿ—„๏ธ **CRUD operations (Create, Read, Update, Delete)**
- ๐Ÿ›ข๏ธ **Database integration with MySQL using Spring Data JPA**
- ๐Ÿ”„ **Object Relational Mapping (ORM)**
- ๐Ÿ“ฆ **Data serialization with Jackson (JSON)**
- โš ๏ธ **Exception handling & validation**
- ๐Ÿ—๏ธ **Layered architecture (Controller โ†’ Service โ†’ Repository)**
- ๐Ÿ› ๏ธ **API testing with Postman**
---

## ๐Ÿš€ Tech Stack
- โ˜• **Java 21**
- ๐ŸŒฑ **Spring Boot 3 / Spring Framework 6**
- ๐Ÿ›ข๏ธ **MySQL**

## ๐Ÿ“ฆ Dependencies
- ๐ŸŒ **Spring Web** โ€“ RESTful API development
- ๐Ÿ—„๏ธ **Spring Data JPA** โ€“ ORM and database queries
- ๐Ÿ”— **MySQL Connector/J** โ€“ JDBC driver for MySQL
- ๐Ÿ“ฆ **Jackson** โ€“ JSON serialization/deserialization
- ๐Ÿงช **Spring Boot Starter Test** โ€“ unit & integration testing

## ๐Ÿ› ๏ธ Development Tools
- ๐Ÿง‘โ€๐Ÿ’ป **VS Code** โ€“ IDE for coding
- ๐Ÿ› ๏ธ **Postman** โ€“ testing and documenting REST endpoints
- ๐Ÿ”— **Git & GitHub** โ€“ version control & collaboration

---

## ๐Ÿ“‚ Project Details

### ๐Ÿ“Œ API Requirements
The API provides a simple **Employee Directory** service where REST clients can:
- ๐Ÿ“‹ Get a list of employees
- ๐Ÿ” Get a single employee by ID
- โž• Add a new employee
- โœ๏ธ Update an existing employee
- โŒ Delete an employee

### ๐ŸŒ API Endpoints
| HTTP Method | URL | CRUD Action | Description |
| ----------- | --- | ----------- | ----------- |
| **POST** | `/api/employees` | **Create** | โž• Add a new employee |
| **GET** | `/api/employees` | **Read** | ๐Ÿ“‹ Fetch all employees |
| **GET** | `/api/employees/{employeeID}` | **Read** | ๐Ÿ” Fetch employee by ID |
| **PUT** | `/api/employees/{employeeID}` | **Update** | โœ๏ธ Update employee details |
| **DELETE** | `/api/employees/{employeeID}` | **Delete** | โŒ Remove employee |