Implement an endpoint to retrieve all comments on a specific blog post. This feature should ensure that users can fetch all comments associated with a particular blog post.
Acceptance Criteria:
API Endpoint Implementation:
[ ] The endpoint should be accessible at /api/v1/blogs/:blog-id/comments.
[ ] The endpoint should handle GET requests.
Authorization:
[ ] Ensure that only authenticated users can access the endpoint.
[ ] Validate the token received in the request to authenticate the user.
Data Handling:
[ ] On successful request, fetch all comments associated with the specified blog post from the database.
[ ] Each comment should include relevant details such as the commenter's name, the comment text, and the timestamp.
Response:
[ ] On success: The API should return a 200 OK status code with the list of comments.
[ ] On failure: The API should return appropriate status codes and messages for different error scenarios (e.g., blog post not found, unauthorized access).
Request Example:
GET /api/v1/blogs/123/comments
Authorization: Bearer
Description:
Implement an endpoint to retrieve all comments on a specific blog post. This feature should ensure that users can fetch all comments associated with a particular blog post.
Acceptance Criteria:
API Endpoint Implementation:
Authorization:
Data Handling:
Response:
Request Example:
GET /api/v1/blogs/123/comments Authorization: Bearer
Successful Response Example:
Error Response Example:
or
or
Purpose:
Enable users to retrieve all comments on a specific blog post, providing a way to view discussions and feedback associated with the post.
Requirements:
Expected Outcome:
Status Codes:
Testing: