GraphQL is an open-source data query language for creating APIs. Built internally by Facebook in 2012 it was later made public in 2015.

Since its launch, GraphQL has attracted a lot of attention and continues to see steady growth.

To understand what GraphQL is and why it’s useful, we need to first understand what an API is and how they are typically implemented.


What is an API?

APIs are deeply connected with many aspects of our lives.Every time we check social media or search something on google we are interacting with an API.

It all happens behind the scenes.

Let’s take youtube as an example. When you type ‘youtube.com’ into your browser a request is made to Google’s servers. Something like:

“Hello Google, could I please view your website. I’m not a robot I promise.”

Google’s servers process the request and formulate a response. In this case, the response is to send back code which your browser can translate into what you recognise as youtube.com.

If you try to visit ‘youtube.com/fake-url’ you will see a message which tells you that the page you were looking for cannot be found. This is because Googles server did not know how to handle your request.

Image for post

Screenshot of 404 Error from YouTube

The part of the server that receives requests and sends out responses is what we call an API. APIs can be created to fulfil any task we need, from publishing a medium article to searching for cute cat videos.

#web-development #programming #graphql #api #rest-api

GraphQL in Plain English
1.60 GEEK