DEV Community

Discussion on: REST API OR GraphQL

Collapse
 
kamranayub profile image
Kamran Ayub

Yeah, this is how we approach it at work (i.e. "an enterprise"). We have something called the "UI facade" which is just a GraphQL layer that talks to our Java REST services that are owned by other teams AND our microservices (session service, auth service, etc.) that we own. Then any client, our UI or another team or another service, can use our GraphQL layer to fetch only what they need without worrying about where it comes from, versioning, auth tokens, etc. It's amazing.

If you are only writing GQL over one REST API and you own both layers, I would just do GQL since its de-facto more flexible and will scale over time super well.