Skip to content

Node Eval#175

Open
acl13 wants to merge 10 commits intoprojectshft:masterfrom
acl13:master
Open

Node Eval#175
acl13 wants to merge 10 commits intoprojectshft:masterfrom
acl13:master

Conversation

@acl13
Copy link

@acl13 acl13 commented Mar 7, 2025

No description provided.

Comment on lines +40 to +43
if (filteredProducts.length === 0) {
response.status(404);
response.send({ message: "No products found" });
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not accurate, is not a client error that there are no filtered products, you can return an empty array and show an empty state in the client.

app.get("/brands/:id/products", (request, response) => {
// Get all products that match the brand id
// The sample data provided has a categoryId property that aligns with the brand id numbers - I think it would be better named "brandId" but chose not to change the existing data
const filteredProducts = products.filter((product) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should validate that the brand id is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants