Skip to content

Implement "Highly Recommended Products" API #106

@Alexandrbig1

Description

@Alexandrbig1

Priority: High
Difficulty: Intermediate
Type: Backend (Node.js + Express + MongoDB)


Description:
We need to implement a new backend API endpoint to serve "Highly Recommended Products" for each product page.
When a user opens a product (e.g., "CoreX Whey Protein"), the frontend should fetch and display products that are contextually related to it — based on shared attributes like category, goals, or collections.


Requirements:

  • Add new route: GET /api/products/:id/recommended
  • Find the product by ID
  • Return up to 6 related products that share:
    • Same category, or
    • At least one matching goal, or
    • At least one matching collection
  • Exclude the original product from the results
  • Sort randomly or by rating
  • Return an empty array if no matches found

Acceptance Criteria:

  • Endpoint works with existing MongoDB schema
  • Proper error handling for invalid IDs
  • Returns up to 6 valid product objects
  • Follows existing backend structure and coding style
  • Tested via Postman or frontend call

Metadata

Metadata

Assignees

Labels

apiAPI endpoints & integrationbackendIssues related to backendhacktoberfestSpecial issue for Hacktoberfesthacktoberfest-2025Special issue for Hacktoberfest 2025mongodbMongoDB & database managementmongooseMongoDB ODM / schema & model work (queries, models, migrations)node.jsBackend JavaScript / runtime (Express, APIs, server work)priority: highNeeds attention ASAP

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions