OpenMRS
React-4: Improve the API Performance in the Node Server
This will be a set of tasks to improve the performance of a minimalized Node.js server.
- You should have finished the task called "React-3" before this task.
- Create a file called
dataService.js
, and create two functions asgetProducts
andgetCategories
. - Inside the
getProducts
function, create a map of products (i.e: { productId: productObject, ... }) and assigned that to a global variable calledproductMap
- Inside the
getCategories
function, create a map of categories (i.e: { ctyId: ctyname, ... }) and assigned that to a global variable calledcategoryMap
- Create a new function called
combineProductsWithCategories
. Inside this function, combine the products and categories and assigned that combined data (as a Map) to a global variable calledcombinedProductMap
- Create a new function called
getCombinedProductMap
. Inside this function, if onlycombinedProductMap
is empty, then call thecombineProductsWithCategories
. Finally, return thecombinedProductMap
. - Refactor your existing API methods to use these methods.
- Integrate
ESLint
with your project. (Help : https://medium.com/the-node-js-collection/why-and-how-to-use-eslint-in-your-project-742d0bc61ed7) - Fix lint issues in the project.
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
Goutam, Michelle, prathamesh_m009, riskycase, Nayan, PermissionError, Ribhav Sharma