Everything I learned in my 1st year as a SWE: GraphQL

Click for: original source

A beginner’s crash course in GraphQL & REST APIs. In this series, I’ll be sharing all the tools and technologies that I’ve picked up in my first year in the hopes of helping other entry-level engineers on their journey. By Camila Ramos.

You tell GraphQL how to come up with the answers to your query. In the schema, you’ve defined what type of each field’s response will be, but the resolvers are where you tell GraphQL how to come up with your data.

In this post author is hoping to answer the following questions:

  • What is an API and how are they used?
  • What is a REST API?
  • The five major problems with REST APIs
    • Rigid endpoints
    • Overfetching
    • Underfetching
    • Multiple requests
    • No idea what the response will be
  • What is GraphQL & why is it used as an alternative to REST?

GraphQL is a query language for your API that allows you to fetch data declaratively - AKA you can tell it exactly what data you want, and it’ll return just that. No more, no less. Instead of working with rigid endpoints that are predefined for you, you can write custom queries to receive the data you need. The GraphQL equivalent to GET is a query, and a mutation is the equivalent to POST, PUT, DELETE, or PATCH. Good read!

[Read More]

Tags devops cloud nosql database