Springboot project to implement RESTful webservices to perform CRUD operations on employee resource using MySQL database. Hibernate used for object relation mapping and maven for build automation. Backend separated into resource, service and repository(DAO) layers.
Employee Object fields
- id
- firstName
- lastName
Request Method & Endpoint - POST https://{host_name}/api/employees
- addEmployee() - save new employee data into the table. Input data is passed as json in the request body
Postman Request and Response
Database
Request Method & Endpoint - GET https://{host_name}/api/employees
- findAll() - fetch entire employee table data and return a json file
Postman Request and Response
Database
Request Method & Endpoint - GET https://{host_name}/api/employees/{employeeId}
- findById() - fetch specific employee data from table using employeeId path variable. Exception Handling - If employeeId does not exists in table runtime exception displaying "Employee id not found" is thrown back.
Postman Request and Response
Request Method & Endpoint - PUT https://{host_name}/api/employees
- updateEmployee - update existing employee data in the table using id attribute. Input data is passed as json in the request body
Postman Request and Response
Database
Request Method & Endpoint - DELETE https://{host_name}/api/employees/{employeeId}
- deleteEmployee - delete specific employee data from table using employeeId path variable. Exception Handling - If employeeId does not exists in table runtime exception displaying "Employee id not found" is thrown back.
Postman Request and Response
Database
- Java 17
- Framework - Springboot
- ORM - Hibernate
- RDBMS - MySQL
- Server - Embedded Tomcat Server
- Build Tool - Maven