samedi 30 octobre 2021

Separate HTTP requests for each dropdown or a single request for a fat FormViewModel?

If the view which serves for creating an item contains some dropboxes / checkboxes / whatever with values from the server, should it send separate requests for filling up those controls with values (one request per each collection of data) or it is better to have a single api endpoint that returns all of the necessary data for filling up the form on front-end?

For the sake of simplicity, I've simulated here an example: Say we're building an app for a car servicing company where clients can make appointments:

enter image description here

Should the front-end app make 2 get requests to api/models and api/services, or these collections can be returned from the server in a single response (from api/appointments/createformdata), What are the best practices regarding to this?

Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire