OpenMRS

React-3: Create an API in the server to fetch product or products to show in the React Application

This will be a set of tasks to develop a minimalized Node.js server.

  1. You should have finished the task called "React-2" before this task.
  2. Create a JSON inside the src/data as categories.json. Add about 4 categories in the following pattern - https://gist.github.com/suthagar23/28639c6471447109e946d7e669ef6519
  3. Create a JSON inside the src/data as products.json. Add about 12 items in the following pattern - https://gist.github.com/suthagar23/bb520138e32f5ddc0e16e4627611cdc3
  4. Create a GET endpoint as /products/all, which needs to send all the products as a JSON. (You need to import the products.json and categories.json, and combine both before sending the response.
  5. Create a GET endpoint as /product/{id}, which needs to send respected product's details for the ID which is required in the request URL. (You need to import the products.json and categories.json, and find the respected product details before sending the response).
  6. Create a GET endpoint as /category/{ctyId}, which needs to send all product's details which are belongs to the ctyId(CategoryId) which is required in the request URL. (You need to import the products.json and categories.json, and find the respected product details before sending the response).

Before making a commit

  • commit message should be: [GCI-<your-gci-id>] message, Otherwise we will not accept your task.

Submission Steps

  1. Submit three postMan request & response screenshots for those three endpoints
  2. Mention your PR link for this work.

Task tags

  • react
  • node.js
  • api
  • development
  • server

Students who completed this task

Michelle, GICMan, Ishaanndas, prathamesh_m009, pl9870, chinemerem, Saad Khaleeq, riskycase, Nayan, PermissionError, Ribhav Sharma, wit03, Goutam, gamer-1748, tixpro, Devanshk09

Task type

  • code Code
close

2019