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.

  1. You should have finished the task called "React-3" before this task.
  2. Create a file called dataService.js, and create two functions as getProducts and getCategories.
  3. Inside the getProducts function, create a map of products (i.e: { productId: productObject, ... }) and assigned that to a global variable called productMap
  4. Inside the getCategories function, create a map of categories (i.e: { ctyId: ctyname, ... }) and assigned that to a global variable called categoryMap
  5. 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 called combinedProductMap
  6. Create a new function called getCombinedProductMap. Inside this function, if only combinedProductMap is empty, then call the combineProductsWithCategories. Finally, return the combinedProductMap.
  7. Refactor your existing API methods to use these methods.
  8. Integrate ESLint with your project. (Help : https://medium.com/the-node-js-collection/why-and-how-to-use-eslint-in-your-project-742d0bc61ed7)
  9. 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

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

Task tags

  • node.js
  • development
  • api
  • server

Students who completed this task

Goutam, Michelle, prathamesh_m009, riskycase, Nayan, PermissionError, Ribhav Sharma

Task type

  • code Code
close

2019