The purpose of this application is to show how to use Maven, Spring, and Tomcat together to produce a functioning Rest API Backend system. This system makes use of an H2 database.
The ArrayList contains Employee objects.
Fields of the employee objects include
- Employee id
- Employee first name
- Employee last name
- Employee Salary
No relationships exist between employee and other objects.
Using the provided seed data, the given endpoint will produce the stated output. Expand each endpoint to see its correct output.
http://localhost:2019/employees/all
[
{
"empid": 2,
"fname": "Sam",
"lname": "Ford",
"salary": 80000.0
},
{
"empid": 1,
"fname": "Steve",
"lname": "Green",
"salary": 45000.0
},
{
"empid": 3,
"fname": "May",
"lname": "Jones",
"salary": 75000.0
}
]http://localhost:2019/employees/name/S
In the Console:
Employee{empid=1, fname='Steve', lname='Green', salary=45000.0}
Employee{empid=2, fname='Sam', lname='Ford', salary=80000.0}
In Postman
[
{
"empid": 1,
"fname": "Steve",
"lname": "Green",
"salary": 45000.0
},
{
"empid": 2,
"fname": "Sam",
"lname": "Ford",
"salary": 80000.0
}
]http://localhost:2019/employees/total
In the Console:
Total Salary 200000.0
In Postman
Status OKhttp://localhost:2019/employees/raise/0.05
[
{
"empid": 1,
"fname": "Steve",
"lname": "Green",
"salary": 47250.0
},
{
"empid": 2,
"fname": "Sam",
"lname": "Ford",
"salary": 84000.0
},
{
"empid": 3,
"fname": "May",
"lname": "Jones",
"salary": 78750.0
}
]