Have you ever wondered that a client can impact an API request? Can he request what he actually needs and get exactly that? If you’re surprised by the questions, I can confirm that you’ve never heard about GraphQL.

So the answer to the above questions will be a definite yes because it’s 100% possible with GraphQL. If you have not heard about it, don’t worry. I’ll walk you through this newest and amazing GraphQL world and you won’t be regret if you get the maximum benefit from this article.

I hope that you are familiar with the Java programming language, the Spring Boot framework, and REST APIs in general. No prior GraphQL experience is required to continue. I know already you are excited about this topic. So why are we waiting? But before moving to the coding, I’ll give a quick overview of GraphQL and the reasons that make it so special.

The First Step to GraphQL

I know what your mind is struggling to find right now. What the heck is this GraphQL? Take a deep breath and let me explain. Simply it’s a data query and manipulation language for your API.

GraphQLexposes a single endpoint thatreceives a query from the front-end as part of the request, returning exactly the requested parts of data in a single response. Of course, I must say: Don’t underestimate the power of a common client.

You can get a clear idea by viewing this GIF. Also, this is a part of the app that we are about to implement today.

GraphQL is used in production by hundreds of organizations of all sizes including Facebook (Actually GraphQL was internally developed by Facebook in 2012 and then it publicly open-sourced in 2015 ), Credit Karma, GitHub, Intuit, PayPal, the New York Times, and many more.

Hey, wait a minute! What’s about REST then. Isn’t it worthy enough anymore? Check this out!

#spring-boot #graphql #mysql

How to Build a GraphQL Server with Spring Boot and MySQL
11.55 GEEK