lundi 4 novembre 2019

how to design api for a single page application having lot of dropdowns for which options has to be sent from backend

I am working on a Single page application with React, and I have lot of drop downs in the page. These drop downs contains multiple options, and I don't want to hard-code options in java script. Instead i need to get the options from API.

Is there any pattern used in such scenarios. I think of multiple ways

  1. single API endpoint which returns all such metadata information like drop down options, menu options and even resource strings. This API will be called initial page load.
  2. Individual APIs for every drop down or page. This API will be called when ever user navigates to new page in client.

Aucun commentaire:

Enregistrer un commentaire