V
V
Volodymyr Vladimirovich2019-07-16 22:58:14
Angular
Volodymyr Vladimirovich, 2019-07-16 22:58:14

How to properly organize API services?

Hello, who keeps the Api Service in large projects?
So far, I see several approaches:
1. Have one api folder in which all services will lie, possibly under folders that repeat the Api structure.
2. In each resource module in the api folder there will be corresponding api services.
3. What is your choice and why?
How do you build responsibility in services.
4. Whether the API service transforms the parameters into the parameters expected for post, put server end point, or do it before sending the service to the api, for example, in a form component or other special file.
5. Do your API services store any state? Or just sending requests. parameters came, sent a request, received a response.
6. Where do you store the state of the loading indicator? Component or globally via interceptor?
7. Do you test such services?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question