<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Calleb Joel Miquissene</title>
    <description>The latest articles on Forem by Calleb Joel Miquissene (@callebdev).</description>
    <link>https://forem.com/callebdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F236255%2Fe847c06c-4017-432d-ac58-5ba0b9b14cbd.jpeg</url>
      <title>Forem: Calleb Joel Miquissene</title>
      <link>https://forem.com/callebdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/callebdev"/>
    <language>en</language>
    <item>
      <title>GraphQL API Tools and Queries</title>
      <dc:creator>Calleb Joel Miquissene</dc:creator>
      <pubDate>Wed, 06 May 2020 15:07:38 +0000</pubDate>
      <link>https://forem.com/callebdev/graphql-api-tools-and-queries-21h8</link>
      <guid>https://forem.com/callebdev/graphql-api-tools-and-queries-21h8</guid>
      <description>&lt;p&gt;Hello, welcome to another article in the GraphQL + JavaScript series, this is the third article in the series but if you are only interested in the topic of this article, feel free to read because I don't use any of the previous articles as a reference so that you have to go back to them to get some concept.&lt;br&gt;
If you have not read the previous two articles, and want to follow the complete series until the creation of the API, I recommend that you read the first two articles because they have a very important content.&lt;br&gt;
At the end of this article you will know what are the tools of the GraphQL API and also how to make a simple query in a GraphQL API.&lt;/p&gt;

&lt;p&gt;Let's do it!&lt;/p&gt;
&lt;h2&gt;
  
  
  GraphQL API tools
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bcuHQmi9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/860/0%2A7REgvfYx0F83mL8Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bcuHQmi9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/860/0%2A7REgvfYx0F83mL8Q.png" alt="Tools"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The GraphQL community has already created several open source tools that allow you to interact with the APIs. These tools allow you to write queries using the GraphQL query language and send them to endpoints in order to receive a response in JSON format (in the next article you will understand why responses are received in this format).&lt;br&gt;
In this series I will use the two most popular tools used to test GraphQL queries in a GraphQL API. These tools are: GraphiQL and GraphQL Playground.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. GraphiQL&lt;/strong&gt;&lt;br&gt;
Created by Facebook, &lt;a href="https://www.electronjs.org/apps/graphiql"&gt;GraphiQL&lt;/a&gt; is one of the most used tools for querying GraphQL APIs.&lt;br&gt;
It is an integrated development environment (IDE) that can be used in the browser or you can download it to your computer.&lt;br&gt;
GraphiQL is a very interactive tool that offers automatic completion (auto-complete), warning in case of errors and allows you to see the results of your queries directly on it.&lt;br&gt;
Most public APIs come with a GraphiQL interface that allows you to query them within the browser.&lt;br&gt;
The GraphiQL interface is composed of two panels. The left panel that allows you to write queries and the right panel that shows you the result of the queries.&lt;br&gt;
In the upper right corner, you can click on Docs to view the service's documentation and learn how to interact with it. This documentation is added to GraphQL automatically because it is read through the service schema.&lt;br&gt;
A schema defines the data available in the service, and GraphiQL automatically creates documentation through a query that it makes to the schema.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. GraphQL PlayGround&lt;/strong&gt;&lt;br&gt;
This is another tool widely used to explore GraphQL APIs. It has the same functions as GraphiQL but comes with a few more features and is more fun.&lt;br&gt;
The most interesting feature that GraphQL Playground has, is the ability to send custom HTTP headers, a feature that will be covered in the next articles when we talk about Authorizations.&lt;br&gt;
GraphQL Playground works in the browser, after being given an endpoint so that you can make queries on it. It also has a desktop version that you can download from the &lt;a href="https://bit.ly/graphql-pg-releases"&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GraphQL public APIs&lt;/strong&gt;&lt;br&gt;
One of the ways you can use to practice queries over a GraphQL API is by using a public API within the tools mentioned above. The same will be done in this series.&lt;br&gt;
You can find many examples of public GraphQL APIs &lt;a href="https://github.com/APIs-guru/graphql-apis"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction to GraphQL Queries
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;(Hehehe finally...)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Queries in the context of GraphQL are operations used to request data from an API. A query is actually an exact description of the data you want to receive from a GraphQL server.&lt;br&gt;
When you send a query, you ask for data units for each field in the query, and if this query is correct, the server sends a JSON response that contains the fields filled with data from the fields you specified in your query.&lt;/p&gt;

&lt;p&gt;Whenever a query is executed against a GraphQL server, it is validated against a type system.&lt;br&gt;
Every GraphQL service defines types in a GraphQL schema. You can think of a type system as a blueprint for your API’s data, backed by a list of objects that you define. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type person {
    id: ID!
    name: String
    birthYear: String
    mass: Float 
    height: Float
    gender: String
    eyeColor: String
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When making a query we must specify which fields exactly we need as an answer.&lt;br&gt;
Suppose we want the name, gender and birth year of the person who has id = 7.&lt;br&gt;
The query would be done as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query {
    person(id:"7"){
        name
        gender
        birthYear
    }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And we would have an answer similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "data":  {
        "person": {
            "name": "Calleb Miquissene",
            "gender": "Male"
            "birthYear: "2000"
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It is possible to see that the answer is given in JSON format and only the data requested in the query is returned.&lt;br&gt;
Now let's make a query in a public API. I chose API &lt;a href="https://countries.trevorblades.com"&gt;Countries&lt;/a&gt;, which has information on continents, and languages ​​based on a list of countries.&lt;br&gt;
When you access the API, it takes you directly to the GraphQL Playground.&lt;br&gt;
By clicking on the Docs tab on the right, you can access the documentation to see the types existing in the API and learn how it works.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xFVZoGTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2ARtsGiHPE2iBK8vszDAhDXA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xFVZoGTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2ARtsGiHPE2iBK8vszDAhDXA.png" alt="Countries APIDocs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our first query should show the name, capital, currency, continent and language of the country whose id is "MZ".&lt;br&gt;
For this we will make the query based on the existing types in the API.&lt;/p&gt;

&lt;p&gt;Query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query{
  country(code:"MZ"){
    name
    capital
    currency
    continent{
      name
    }
    languages{
      name
    }
  }

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;GraphQL server response:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WstFfOVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1228/1%2AWN6Tmmy73_3peR1UQWfnug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WstFfOVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1228/1%2AWN6Tmmy73_3peR1UQWfnug.png" alt="Response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And we come to the end of another chapter in this series. I hope you liked it!&lt;br&gt;
If you have any comments, doubts or suggestions regarding this article, leave it in the comments and don't forget to leave your ❤!&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>graphiql</category>
      <category>graphqlplayground</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Understanding GraphQL and its Design Principles</title>
      <dc:creator>Calleb Joel Miquissene</dc:creator>
      <pubDate>Tue, 28 Apr 2020 00:03:58 +0000</pubDate>
      <link>https://forem.com/callebdev/understanding-graphql-and-its-design-principles-fd6</link>
      <guid>https://forem.com/callebdev/understanding-graphql-and-its-design-principles-fd6</guid>
      <description>&lt;p&gt;Welcome to this article!&lt;br&gt;
Now that you know what GraphQL is, its history and how it works, it's time to understand it better.&lt;br&gt;
If you fell randomly in this article, I am pleased to inform you that this is the second article in a series that covers GraphQL and will guide you through the creation of your first GraphQL API using JavaScript.&lt;br&gt;
If you haven't read the &lt;a href="https://dev.to/callebdev/so-what-is-graphql-3l9"&gt;first article&lt;/a&gt; in the series, you can take a look at it afterwards because it has a very important content in case you want to understand better about the emergence of GraphQL and its operation.&lt;br&gt;
I hope you have a wonderful reading.&lt;/p&gt;

&lt;h1&gt;
  
  
  What language to use to create my API?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.pngitem.com%2Fpimgs%2Fm%2F602-6026198_detail-page-image-thumbnail-programming-languages-icon-png.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.pngitem.com%2Fpimgs%2Fm%2F602-6026198_detail-page-image-thumbnail-programming-languages-icon-png.png" alt="Programming languages"&gt;&lt;/a&gt;&lt;br&gt;
As mentioned in the previous article, GraphQL is a declarative query language, this means that it allows you to query exactly and exclusively the data needed without worrying about how get for them. (It probably may not be very clear now, but I will discuss this point later :)).&lt;br&gt;
GraphQL Server libraries exist for several programming languages ​​including JavaScript, C #, Java, Groovy, .NET, PHP, Scala, Python, Ruby, Erlang, Clojure, Elixir and Go.&lt;br&gt;
The techniques that will be used in this series to build GraphQL services can be applied in any programming language, but this series is focused in the use of JavaScript create them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GraphQL is actually a specification!&lt;/strong&gt;&lt;br&gt;
A specification refers to the description of characteristics of a language. The advantage of a specification is that it offers a common vocabulary and good practices for using the language.&lt;br&gt;
GraphQL is a language specification for client-server communication.&lt;/p&gt;

&lt;h1&gt;
  
  
  GraphQL design principles
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimage.slidesharecdn.com%2Fgraphql-oop-180219201201%2F95%2Fgraphql-the-new-lingua-franca-for-apidevelopment-33-638.jpg%3Fcb%3D1519072211" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimage.slidesharecdn.com%2Fgraphql-oop-180219201201%2F95%2Fgraphql-the-new-lingua-franca-for-apidevelopment-33-638.jpg%3Fcb%3D1519072211"&gt;&lt;/a&gt;&lt;br&gt;
It is not because GraphQL allows you to build your API in any way and language you want, that it does not offer you principles for building your service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hierarchical&lt;/strong&gt;&lt;br&gt;
A GraphQL query is hierarchical. Fields are nested within other fields and the query is shaped like the data that it returns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Product centric&lt;/strong&gt;&lt;br&gt;
GraphQL is driven by the data needs of the client and the language and runtime that support the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strong typing&lt;/strong&gt;&lt;br&gt;
A GraphQL server is backed by the GraphQL type system. In the schema, each data point has a specific type against which it will be validated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client-specified queries&lt;/strong&gt;&lt;br&gt;
A GraphQL server provides the capabilities that the clients are allowed to consume.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introspective&lt;/strong&gt;&lt;br&gt;
The GraphQL language is able to query the GraphQL server’s type system.&lt;/p&gt;

&lt;p&gt;In the next article, you'll see GraphQL in practice, the famous queries and how to do them. For this I will use a public API where we will make our queries.&lt;br&gt;
If you have any questions, suggestions or comments regarding the content covered in this article, leave it in the comments!&lt;br&gt;
If you liked the article don't forget to leave your LIKE ❤!&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>designprinciples</category>
      <category>javascript</category>
      <category>database</category>
    </item>
    <item>
      <title>So what is GraphQL?</title>
      <dc:creator>Calleb Joel Miquissene</dc:creator>
      <pubDate>Fri, 24 Apr 2020 02:01:41 +0000</pubDate>
      <link>https://forem.com/callebdev/so-what-is-graphql-3l9</link>
      <guid>https://forem.com/callebdev/so-what-is-graphql-3l9</guid>
      <description>&lt;p&gt;Well, welcome to this "wonderful" article about GraphQL!&lt;br&gt;
If you fell here, you are probably learning about GraphQL or researching it.&lt;br&gt;
This is the first of some articles that I will publish here about GraphQL.&lt;br&gt;
Because of this, and in order to provide you with a delicate reading, I will do my best to explain in detail all the concepts that are likely to cause some doubt regardless of your level of familiarity with the topic covered here ...&lt;br&gt;
For this I will use the redundancy methodology that consists of repeating the same thing in different ways and with different examples in order to place the same content in different parts of your brain!&lt;br&gt;
Tip given, let's do it!&lt;/p&gt;

&lt;h2&gt;
  
  
  GraphQL History
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Chapter 1: Genesis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjashow.org%2Farticles%2Fwp-content%2Fuploads%2F2012%2F01%2FDays-of-creation.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjashow.org%2Farticles%2Fwp-content%2Fuploads%2F2012%2F01%2FDays-of-creation.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In 2012, Facebook decided to rebuild its native mobile apps (iOS and Android).&lt;br&gt;
The applications' performance was not very good because they were having constant crashes. At that time, Facebook had a RESTful server and its data was in FQL tables (an SQL version of Facebook).&lt;br&gt;
Due to the problem with their native applications on mobile versions, Facebook engineers realized that the problem was caused by the way the applications received the data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Probably they sat down, had a cup of coffee and discussed the problem)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The engineers then decided to improve the way data was being sent to applications.&lt;br&gt;
This decision resulted in a query language that would describe the features and requirements of the data models for the company's client / server applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chapter 2: The big (or misunderstood) battle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbloody-disgusting.com%2Fwp-content%2Fuploads%2F2018%2F07%2FWar-of-the-Worlds.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbloody-disgusting.com%2Fwp-content%2Fuploads%2F2018%2F07%2FWar-of-the-Worlds.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In July 2015, the team of Lee Byron, Nick Schrock and Dan Schafer, Facebook engineers, released the first GraphQL specification and the reference for its implementation in JavaScript, called graphql.js.&lt;br&gt;
As of September 2016, it was officially ready for use, although Facebook has been using it in production for a few years.&lt;/p&gt;

&lt;p&gt;But, on the other hand, there was the REST created in 2000 and that had been in use for a long time.&lt;br&gt;
REST stands for Representational State Transfer, it relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used. REST is an architecture style for designing networked applications.&lt;/p&gt;

&lt;p&gt;When GraphQL came into existence, many programmers believed that it came to replace REST.&lt;br&gt;
The controversy was big and sparked debate at conferences, but calling GraphQL a REST killer is an oversimplification. A more subtle view is that, as the Web has evolved, REST has shown signs of tension under certain conditions. GraphQL was created to alleviate this tension (which will be explained in the next chapters).&lt;/p&gt;

&lt;h2&gt;
  
  
  How does GraphQL work?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimage.freepik.com%2Ffree-vector%2Fsystem-gears-cogs-working-with-chain-dark-black-gears-cogs-chalkboard_35756-176.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimage.freepik.com%2Ffree-vector%2Fsystem-gears-cogs-working-with-chain-dark-black-gears-cogs-chalkboard_35756-176.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GraphQL is a syntax that describes how to ask for data, and is generally used to load data from a server to a client.&lt;br&gt;
It’s also a runtime for fulfilling queries with your data. The GraphQL service is transport agnostic but is&lt;br&gt;
typically served over HTTP.&lt;br&gt;
The query is nested, and when it is executed, can traverse related objects. This allows us to make one HTTP request for two types of data. We don’t need to make several round trips to drill down into multiple objects. We don’t receive additional unwanted data about those types. With GraphQL, our clients can obtain all of the data they need in one request.&lt;/p&gt;

&lt;p&gt;Whenever a query is executed against a GraphQL server, it is validated against a type system. Every GraphQL service defines types in a GraphQL schema. You can think of a type system as a blueprint for your API’s data, backed by a list of objects that you define.&lt;/p&gt;

&lt;p&gt;GraphQL is often referred to as a declarative data-fetching language. By that, we mean that developers will list their data requirements as what data they need without focusing on how they’re going to get it. GraphQL server libraries exist in a variety of different languages including C#, Clojure, Elixir, Erlang, Go, Groovy, Java, JavaScript, .NET, PHP, Python, Scala, and Ruby.&lt;/p&gt;

&lt;p&gt;If you have any questions or suggestions about this article, feel free to post it in the comments!&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>data</category>
      <category>software</category>
    </item>
  </channel>
</rss>
