K
K
Konstantin2020-01-24 23:54:38
Angular
Konstantin, 2020-01-24 23:54:38

How to create an API adapter in Angular?

There is a service which is used by several components.
How to write an adapter - API layer for this service?
Or is this not necessary, while the service itself is already a kind of API?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2020-01-25
@Junart1


Or is this not necessary, while the service itself is already a kind of API?
Yes.
Sometimes combined with a storage/caching service, sometimes not.
Good practice is one api family - one service. Type usersService, it has GET, POST, etc. users.
Additional manipulations with requests, insert the header there, redirect - in interceptors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question