I'm creating REST API that will be used by a web page.
There are several types of data I should provide, and I'm wondering what would be the best practice:
- Create one method that will return a complex object with all the needed data.
- Pros: one call will be needed from the UI side to get all the data.
- Cons: not generic solution at all.
- Create multiple autonomous method.
- Pros: generic enough to be used in the future by other components.
- Cons: will require the UI to make several calls to the server.
Which one adheres more to best practices?