Suppose we have an API server with several endpoints that serves user requests. I have been wondering what is a good trade-off between implementing logic in the API server vs. delegating to other microservices.
For example, suppose we want to fetch data from a database upon an API call. Should database query:
- Be performed by the API itself?
- Delegated to a separate microservice that handles database queries?
- Delegated to something even simpler than a microservice, say a lambda function in the cloud?
Thanks for help.