3 ms·
Most GraphQL presentations I have seen tend to construct the following strawman scenario: - we have a REST API that forces the client to make too many requests
by voidr 8y ago
Most GraphQL presentations I have seen tend to construct the following strawman scenario:
- we have a REST API that forces the client to make too many requests
- it's impossible to fix the REST API for some reason
- the app is slow because of the multiple REST API calls
The followup:
- we bring in GraphQL and everything becomes super fast and efficient
- the people who couldn't provide an efficient REST API, can all the sudden provide a GraphQL interface
- the cost of implementing and maintaining GraphQL is usually glossed over
The reality is that GraphQL has a lot of drawbacks that are overlooked:
- it might be cheaper to fix the REST API than to implement GraphQL
- it's one extra service or module(if you are lucky) on your backend to look after
- protecting the database from bad queries becomes an order of magnitude harder
- you will have to maintain an additional GraphQL schema
- the client side tooling for GraphQL is far from simple
Depending on your needs, it might still be worth it, I would just wish that GraphQL presentations would be more honest about these.