Developed using Java Spring framework, this is a collection of endpoints that can be used to run CRUD operations on Employee table
id (UUID or autogenerated)
firstName
lastName
email
department
salary- Java version 17
- Maven
git clone git@github.com:itisprasad/employeemanagement.gitcd employeemanagement
mvn spring-boot:runcurl -X POST http://localhost:8080/api/employees -H "Content-Type: application/json" -d '{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"department": "IT",
"salary": 60000
}'Output
{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"John","lastName":"Doe","email":"john.doe@example.com","department":"IT","salary":60000.0}curl -X GET "http://localhost:8080/api/employees"Output
[{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"John","lastName":"Doe","email":"john.doe@example.com","department":"IT","salary":60000.0},{"id":"7805ccaa-485e-4744-8766-d0c2f34ec29f","firstName":"John","lastName":"Doe","email":"john.doe1@example.com","department":"IT","salary":60000.0}]curl -X GET "http://localhost:8080/api/employees/a9fcd855-23b1-4862-b8f4-e36c195e7df4"Output
{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"John","lastName":"Doe","email":"john.doe@example.com","department":"IT","salary":60000.0}curl -X PUT http://localhost:8080/api/employees/a9fcd855-23b1-4862-b8f4-e36c195e7df4 -H "Content-Type: application
/json" -d '{
"firstName": "Jane",
"lastName": "Doe",
"email": "jane.doe0@example.com",
"department": "HR",
"salary": 75000
}'Output
{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"Jane","lastName":"Doe","email":"jane.doe0@example.com","department":"HR","salary":75000.0}curl -X DELETE "http://localhost:8080/api/employees/{ID}"mvn testOutput
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 15.56 s -- in com.employee.controller.EmployeeControllerTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.453 s
[INFO] Finished at: 2025-02-04T23:06:49+07:00
[INFO] ------------------------------------------------------------------------