JiayangYing / CITS3403_PRO

MIT License
2 stars 0 forks source link

Implement Flask Routes for Product Management #55

Closed JiayangYing closed 6 months ago

JiayangYing commented 6 months ago

Description

We need to implement two Flask routes for our product management system:

  1. @app.route('/product') - This route will return information about all products in our database or data structure. It should provide a JSON response listing all products.
  2. @app.route('/product/') - This route will return details of a specific product identified by product_id. If the product exists, it should return the product's details in JSON format. If the product does not exist, it should return a 404 Not Found error.

Requirements

  1. Implement the Flask routes as described.
  2. Ensure the routes handle errors gracefully, especially for non-existent product IDs.

Expected Behavior

  1. /product: Should list all products.
  2. /product/: Should return the details of the product if found, or a 404 error if not found.

Additional Notes

  1. Please consider scalability and potential future integration with a real database.
  2. Include basic unit tests to verify the routes' functionality.
JiayangYing commented 6 months ago

closed #59