HackYourFuture-CPH / fp-class19

MIT License
3 stars 1 forks source link

Update the endpoint /api/favorites/add with error handlers/throw error #193

Closed Divyajg closed 2 years ago

Divyajg commented 2 years ago

User story

Who: As a developer What: I want to update the end-point /api/favorites/add with error handlers/throw error Why: so that I can see the difference between the correct and wrong entries of the query

Acceptance criteria

If the ((user_id && product_id)===number)=> it should show the result and status code:200, If the ((user_id || product_id) || (user_id && product_id) ===NaN || null)=> it should show an error message with status code other than 200.

Implementation Details

Update the Post endpoint for /api/favorites/add with the required responses.

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/

FlorentinaPetica commented 2 years ago

Close by PR https://github.com/HackYourFuture-CPH/fp-class19/pull/199