Secondly, unlike REST APIs, GraphQL takes a strong opinion on avoiding versioning and instead serves versionless API. Both of these situations lead to potential issues, for under-fetching, it leads to multiple requests being required to multiple endpoints as described above, and for over-fetching, it leads to wasted bandwidth and increased latency while waiting for larger than-required responses being sent and processed. This solves a couple of problems that REST APIs have firstly, the requirement to send multiple requests to different endpoints to fetch all the data we need, and secondly, over/under-fetching data from a single endpoint.īecause in a REST API, the server controls the structure and data included in a response, the client might receive a lot more data than they need (over-fetching) or the opposite and not get all the data they require (under-fetching). One of the largest benefits of GraphQL is the ability for the client to request just the data they need and receive it all in a single response. GraphQL APIs offer a couple of enticing benefits over their REST counterparts. But, before we jump into building our example API, let’s explore GraphQL APIs a bit further. So, in this tutorial, we’re going to explore GraphQL APIs further and build a GraphQL version of the REST API we built in this post.įor this tutorial, we’re going to be using AWS AppSync to create our GraphQL API as well as DynamoDB for our database as we did in that previous post. When it comes to building an API, the default choice is often to use a REST API but in recent years GraphQL APIs have been gaining popularity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |