Allows getting all employees & getting single employee by employee id
Number of Fixes
N/A
Related Ticket(s)
Relates to #55 & #6
Problem to Solve
We need to handle GET requests for getting employee data
Proposed Changes
EmployeesModel.js makes a call to the db, returning the data or an error;
employeesCtrl.js takes the response from EmployeesModel, formatting data in JSON and sending a 200 server response, or sending the the error along
routes/employees/employees.js funnels the URL path to the appropriate GET call.
Expected Behavior
Starting up the server, going to `localhost:[PORT]/employees/
Steps to Test Solution
In app.js, add app.use(routes)
In routes/index.js, comment out the route to products
In routes/employees/index.js, comment out all other app.use(require(...)) statements that are not app.use(require('./employees'))
Testing
[ ] There are new unit tests in this PR, and I verify that there is full coverage of all new code.
[X] I certify that all existing tests pass
Description
Allows getting all employees & getting single employee by employee id
Number of Fixes
N/A
Related Ticket(s)
Relates to #55 & #6
Problem to Solve
We need to handle
GET
requests for getting employee dataProposed Changes
EmployeesModel.js
makes a call to the db, returning the data or an error;employeesCtrl.js
takes the response fromEmployeesModel
, formatting data in JSON and sending a200
server response, or sending the the error alongroutes/employees/employees.js
funnels theURL
path to the appropriateGET
call.Expected Behavior
Starting up the server, going to `localhost:[PORT]/employees/
Steps to Test Solution
app.js
, addapp.use(routes)
routes/index.js
, comment out the route toproducts
routes/employees/index.js
, comment out all otherapp.use(require(...))
statements that are notapp.use(require('./employees'))
Testing
[ ] There are new unit tests in this PR, and I verify that there is full coverage of all new code. [X] I certify that all existing tests pass