Skip to content

Basic CRUD API application to store employee and department details using Java, SpringBoot

Notifications You must be signed in to change notification settings

varunswing/Employee-Department-CrudAPIs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Employee ID: T2551
Employee Name: Varun Sharma

Employee/Department Management Based CRUD APIs

This project contains employee informations and perform CRUD APIs

Install and Run Redis for Caching

####Install

brew install redis

####Run the server

brew services start redis

Monitor Redis

redis-cli MONITOR

###Run Tests

mvn test

###Run the application

mvn spring-boot:run

Alternatively, you can also navigate to target directory and run the application using

cd target
java -jar emp-api-0.0.1-SNAPSHOT.jar

Operations on Employee

GET Requests

Get all Employees

curl http://localhost:8083/api/employee

Get Employee by thier id

curl http://localhost:8083/api/employee/id/{{empId}}

Get Employees by thier Department

curl http://localhost:8083/api/employee/dept/{{deptId}}

POST Requests

Add a new Employee

curl -X POST -H "Content-Type:application/json" \
 -d '{"name":"Varun","email":"[email protected]","dob":"2000-16-10","deptId":1}' \
 http://localhost:8083/api/employee

PUT Requests

Update an Employee

curl -X PUT http://localhost:8083/api/employee/<id>?name=<name>&email=<email>&deptId=<deptId>

DELETE Requests

Delete an Employee

curl -X DELETE http://localhost:8083/api/employee/<id>

Operations on Depertmant

GET Requests

Get all Departments

curl http://localhost:8083/api/department

Get Department by id

curl http://localhost:8083/api/department/{{deptId}}

POST Requests

Add a new Department

curl -X POST -H "Content-Type:application/json" \
 -d '{"name":"FASTag","manager":"abc"}' \
 http://localhost:8083/api/department

PUT Requests

Update a Department

curl -X PUT http://localhost:8083/api/department/<id>?name=<name>&manager=<manager>

DELETE Requests

Delete a department

curl -X DELETE http://localhost:8083/api/department/<id>

About

Basic CRUD API application to store employee and department details using Java, SpringBoot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages