How to build Scalable APIs using GraphQL and Serverless

How to build Scalable APIs using GraphQL and Serverless

GraphQL and Serverless Tutorial: Learn how to build Scalable APIs using GraphQL and Serverless

GraphQL is a different way to connect your client applications to your backend. In general, we are used to REST, where the client connects to the backend via a defined endpoint. When connecting to an endpoint, the client needs to specify headers, an HTTP method (GET, POST, DELETE, etc.), a body, and all kinds of parameters. Usually, he needs to be familiar with all the information beforehand to be able to request the information from the server. The client might end up getting a lot of information back that isn’t needed (over fetch) and often forces him to do a lot of calls to the backend to populate a view since one request only brings part of the information needed (under fetch).

GraphQL has some important characteristics. Between the client and the server, a contract is signed, called the GraphQL schema. Here, all possible types of operations that the client can perform on the backend are defined. The client can call an operation with one request, which will return multiple types if needed so that there is no under fetch of information. The client can also specify attributes for the types it wants so that there is no over fetch of information.

GraphQL is implemented between the client and the data sources, making GraphQL a single entry point to the backend. The data sources can be anything from NoSQL databases, relational databases, and HTTP servers to whatever returns data. To connect a GraphQL implementation to the data sources, you need to write resolvers. Resolvers are a very important part of your GraphQL application, as they are the ones that translate GraphQL requests or responses to whatever the data sources understand. For example, if the data source is a relational database, the resolver will need to know how to transform a GraphQL query into a SELECT operation and then translate whatever the relational database returns into a GraphQL response.

Current trends in software and backend architecture have been evolving towards a more loosely coupled more granular design. I am sure most of you have heard of microservice based architectures. The latest development on that front in the past couple of years has been the advent of Serverless which allows you to run applications in very cost effective ephemeral services. This is why it is important to have a proper gateway for your API that is able to route all your requests to the designated endpoint.

GraphQL stands out in that respect as being a mature open sourced standard started at Facebook. We will first have a look at how we set up our own GraphQL server locally, then we will explore the Query language and schema definitions it provides which allows you essentially query your mesh of services from a single point of entry. The beauty of that is it will notify you early if any of your endpoints is misbehaving or the schemas are out of date by erring out. Another advantage of this is that it allows for your API documentation to be a real time process and it will give you what one may call an API playground where you can query and explore your API.

After we explore our Serverless API we will have a look at the more advanced features and standards around mutators and resolvers and then we will close by going all in, full Serverless and deploy our GraphQL server to a function in the cloud.

Speakers: Simona Cotin - Senior Cloud Advocate, Microsoft Matteo Collina - Technical Director, NearForm

Source Code: https://mybuild.techcommunity.microsoft.com/VideoDownloader/Download-BuildResources.zip

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

The Mergence of GraphQL and Serverless

Learn how the Graphql and Serverless can be used together and I'll do a little demo with the Serverless framework. Why these two technologies (Graphql & Serverless) have drastically gained popularity and what problems they were made to solve.

How to Build Scalable APIs Using GraphQL and Serverless

In this GraphQL and Serverless tutorial, you'll learn how to build Scalable APIs Using GraphQL and Serverless. Exploring Serverless API, we will have a look at the more advanced features and standards around mutators and resolvers and then she will close by going all in, full Serverless and deploy a GraphQL server to a function in the cloud.

Build fullstack GraphQL & Serverless Apps with the 3factor Architecture

Build fullstack GraphQL & Serverless Apps with the 3factor Architecture