This is a REST API for managing employees, implemented with reactive programming using Spring Boot and MongoDB. It provides CRUD functionalities (Create, Read, Update, Delete) for efficiently managing employees.
- Java 21
- Spring Boot 3
- Spring WebFlux
- Spring Data MongoDB
- MongoDB
- Project Reactor
- Lombok
- Maven
- JDK 17 or higher
- MongoDB
- Maven
-
Clone the repository:
git clone https://github.com/AlexisMartinez1913/reactive-employee-rest-api.git cd reactive-employee-rest-api
-
Configure your MongoDB connection in the application.properties or application.yml file:
spring.data.mongodb.uri=mongodb://localhost:27017/your-database
-
Build and run the project:
mvn clean install mvn spring-boot:run
URL: /api/employees
Method: POST
Request Body:
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
}
Response:
{
"id": "60c72b2f9b1e8a5b3c3e7a7e",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
}
URL: /api/employees
Method: GET
Response:
[
{
"id": "60c72b2f9b1e8a5b3c3e7a7e",
"firstName": "John",
"lastName": "Doe",
}
]
URL: /api/employees/{id}
Method: GET
Response:
{
"id": "60c72b2f9b1e8a5b3c3e7a7e",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
}
URL: /api/employees/{id}
Method: PUT
Request Body:
{
"firstName": "Jane",
"lastName": "Doe",
"email": "[email protected]",
}
Response:
{
"id": "60c72b2f9b1e8a5b3c3e7a7e",
"firstName": "Jane",
"lastName": "Doe",
"email": "[email protected]",
}
URL: /api/employees/{id}
Method: DELETE
Response:
{
"message": "Employee deleted successfully."
}
Contributions are welcome. To contribute, please follow these steps:
- Fork the repository.
- Create a new branch (git checkout -b feature/new-feature).
- Make your changes and commit them (git commit -m 'Add new feature').
- Push to the branch (git push origin feature/new-feature).
- Open a Pull Request.