Skip to content

Instantly share code, notes, and snippets.

@santuman
Last active July 23, 2021 13:49
Show Gist options
  • Save santuman/5d566d3bbcb82a11b5b6785bdb161fea to your computer and use it in GitHub Desktop.
Save santuman/5d566d3bbcb82a11b5b6785bdb161fea to your computer and use it in GitHub Desktop.

GraphQL over RestFul Api

Setting up an endpoint becomes messier as we go along with creating endpoints for nested relationsship

For Example endpoint for getting users friends of friends company, position

Making too many HTTP request

We need to make many request to get friends of friends company, position like

GET /user/23/friend/2/company

GET /user/23/friend/2/position

Vulnerability of over fetching data.

We might fetch whole Schema of Company, but we might only need 1 or 2 properties only.

These issues can be solved in RestFul Api but solving these issue is some engineering overhead and takes a lot of time.

This why GraphQL comes to save our day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment