chicken-sloths / bangazon-api-sprint1

API for a mock Amazon + Etsy platform providing developers access to the company's employee & product data
0 stars 0 forks source link

getAllEmployees & getSingleEmployee #89

Closed DavidLarsKetch closed 6 years ago

DavidLarsKetch commented 6 years ago

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 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

  1. In app.js, add app.use(routes)
  2. In routes/index.js, comment out the route to products
  3. 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