4human-org / murphy-ecommerce-backend

Backend Repo for the Murphy E-Commerce App
2 stars 1 forks source link

Swagger Documentation Added #27

Closed Calesi19 closed 3 months ago

Calesi19 commented 3 months ago

I added Swagger UI to the repository. This will allow anyone to have quick access to the documentation and structure of the API. Useful to establish contracts with the Frontend Team.

CHANGES:

  1. A minor fix to the PATCH endpoint.

    • Before, the PATCH endpoint required the request to have the id of the document inside of the request body. Now, the PATCH endpoint requires the request to have the document id as a parameter ("/products/:id").
    • This makes it more clear what document the PATCH endpoint should be targeting.
    • This makes it harder for the request body to update the id of the document or introduce a secondary id.
  2. Swagger UI Added. Visit "localhost:3030/api-docs" when running the API.

    • This provides documentation of all the endpoints in the API and what they require.
    • This also provides quicker testing.
    • The video below shows an example of testing the GET endpoints using Swagger.

https://github.com/4human-org/murphy-ecommerce-backend/assets/58052598/07c80fa0-e03c-4359-b244-4dc69247a5ba