3 ms·
I agree with the other answers here: it depends on the use case. But all else being equal, I'd start with a REST API, and build an additional (not replacement)
by fcarraldo 8y ago
I agree with the other answers here: it depends on the use case. But all else being equal, I'd start with a REST API, and build an additional (not replacement) GraphQL API when necessary.
Using GraphQL to create, fetch and write individual objects in a typical CRUD app, without complex object relationships, adds a good bit of unnecessary complexity. Luckily, this is where REST shines.
If/when the domain model evolves, building a parallel GraphQL API for complex (read-only) queries will help solve querying/filtering/complex object fetching better than REST can.
GraphQL for writes/updates doesn't seem worth it for general use cases, but can be appropriate if it matches your domain model.
- jaxn 8y agoThis depends on the tooling a little. We are getting a fair amount of cacheing and state management for "free" by using Apollo with GraphQL.