So literally, there's no separation of concern, because your schema gets created from a resolvers, and resolvers is the only code you're out. So you don't have any control about how the schema actually will look like in the end. So there was a solution for this, which is SDL first GraphQL server, also known as schema first GraphQL server.
So the idea here is that you write your schema, you can either do it in GraphQL SDL, hence the SDL first server, or you can do it with some external libraries. So there is the GraphQL JS library, which lets you write schema first GraphQL servers, but not using SDL, but using their own methods instead. But the idea is simple, you create your schema, you create your resolvers based on this schema, and this will create a server for you. So you have a very nice separation of concern, you have your schemas separated from a resolvers, and you are in full control of everything. But this, of course, has the major downsides and writing both resolvers and schemas is a lot of work.
So luckily, there's a solution. You can also create your GraphQL API automatically from a schema. And this you can be done with step 10, an example. So let's have a look about how this works. So creating a graph API with step 10 is very straightforward. You just write your schema. You can define all the types that you have. And these types will be linked to a data source they're coming from. And this can be any back end as we'll see later on. And our CLI will then generate resolvers in the server automatically for you, right in the cloud. So it will be deployed serverless, you don't have to worry about any deployments or about scalability of your resolvers. So steps and you can connect any data source.
So it can be databases, either SQL or Postgres. It can be REST APIs, it can be GraphQL APIs, you can literally connect any other data source. And then based on this data source, a fully performance serverless GraphQL API will be created for you. So no longer do we have to worry about scalability, about performance, about deployments, it will all be done for you. And this uses just GraphQL schema design language. And here are two examples for MySQL Postgres on the left and REST on the right. As you can see, it's using custom directives in order to link to data source. So right from in your schema using just GraphQL schema design language, you can create connections with any back end or any data source. And next to Postgres than REST, you can also use any other GraphQL API as your data source, as we'll see in this example. So what we have here is a schema.
Comments