HackYourFuture-CPH / fp-class19

MIT License
3 stars 1 forks source link

Update the End-point /api/products/on_discount with error handlers #195

Closed Divyajg closed 2 years ago

Divyajg commented 2 years ago

User story

Who: As a developer What: I want to update the endpoint /api/products/on_discount in products.controller.js and products.router.js with the error handlers/ throw errors. Why: so that I can have the error message and status code on getting errors

Acceptance criteria

Response code 200 for successful query and 400/404/500 for failed query

Implementation Details

Update the Get endpoint /api/products/on_discount with the error handling.

Read about Swagger here https://github.com/HackYourFuture-CPH/fp-class18/#-working-with-api-documentation---swagger and this article should also help you with that https://blog.logrocket.com/documenting-your-express-api-with-swagger/