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.
- You should have finished the task called "React-2" before this task.
- Create a JSON inside the
src/data
ascategories.json
. Add about 4 categories in the following pattern - https://gist.github.com/suthagar23/28639c6471447109e946d7e669ef6519 - Create a JSON inside the
src/data
asproducts.json
. Add about 12 items in the following pattern - https://gist.github.com/suthagar23/bb520138e32f5ddc0e16e4627611cdc3 - Create a
GET
endpoint as/products/all
, which needs to send all the products as a JSON. (You need to import theproducts.json
andcategories.json
, and combine both before sending the response. - 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 theproducts.json
andcategories.json
, and find the respected product details before sending the response). - Create a
GET
endpoint as/category/{ctyId}
, which needs to send all product's details which are belongs to thectyId
(CategoryId) which is required in the request URL. (You need to import theproducts.json
andcategories.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
- Submit three postMan request & response screenshots for those three endpoints
- Mention your PR link for this work.
Task tags
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