<?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>DEV Community: Khaled Garbaya</title>
    <description>The latest articles on DEV Community by Khaled Garbaya (@khaled_garbaya).</description>
    <link>https://dev.to/khaled_garbaya</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%2F60404%2F5d59548a-49ea-45f3-8be3-dbd5a62d24dd.jpg</url>
      <title>DEV Community: Khaled Garbaya</title>
      <link>https://dev.to/khaled_garbaya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khaled_garbaya"/>
    <language>en</language>
    <item>
      <title>An introduction to start using Eleventy</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Sun, 07 Feb 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/an-introduction-to-start-using-eleventy-2j74</link>
      <guid>https://dev.to/khaled_garbaya/an-introduction-to-start-using-eleventy-2j74</guid>
      <description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I released a Course on 11ty and the jamstack. &lt;a href="https://realworldjamstack.dev/"&gt;You can get it now by clicking here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Eleventy, or 11ty, is a powerful yet straightforward static site generator. It does not require any config to get started. This what it will take you to get an 11ty project running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @11ty/eleventy
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'# Page header'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; README.md 
eleventy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bootstrap an eleventy project
&lt;/h2&gt;

&lt;p&gt;We'll start from an empty directory, initialize it as an npm package by calling &lt;code&gt;npm init -y&lt;/code&gt;. Install @11ty/eleventy, &lt;code&gt;npm i -D @11ty/eleventy&lt;/code&gt;, package and create the website entry point. Eleventy can compile multiple file formats, HTML, markdown, liquid, and njk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Eleventy Layouts
&lt;/h2&gt;

&lt;p&gt;Eleventy Layouts are special templates that you can use to wrap other content. For more information, check the layouts docs.&lt;/p&gt;

&lt;p&gt;Layouts will live in an _includes folder at the root of your project. For example, if you want to share a standard structure through all your blog posts page first, you need to create a file inside the _includes folder and give it a name; let's call it &lt;code&gt;mylayout.njk&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Add the wrapping HTML code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;--------
title: My Website
--------
&lt;span class="cp"&gt;&amp;lt;!doctype html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;{{ title }}&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- any page content that uses this layout goes here--&amp;gt;&lt;/span&gt; 
    {{ content | safe}}
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use a layout, you need to specify the frontmatter &lt;code&gt;layout&lt;/code&gt; property inside the desired file. In this case, it will &lt;code&gt;post.md&lt;/code&gt; at the root level of the project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;--------
layout: mainlayout.njk
title: My First Post
tags: post
--------

## My First Post
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Layouts in eleventy can use other layouts. You can also use a different template engine across layouts. This feature is convenient if we want to wrap some pages with extra markup but not all the pages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create pages from data in Eleventy
&lt;/h2&gt;

&lt;p&gt;Eleventy supports a few data sources, JSON, and js files. Let's take the example of creating pages from a list of pokemon in a JSON file.&lt;/p&gt;

&lt;p&gt;First, create a &lt;code&gt;_data&lt;/code&gt; folder at the root of your project, then create a &lt;code&gt;pokemons.json&lt;/code&gt; file inside the newly created folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Pikachu"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"power"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Static"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Charizard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"power"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fire"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create a file &lt;code&gt;pokemon-page.njk&lt;/code&gt; at the root of your project. To make use of the data, you can use the frontmatter property &lt;code&gt;pagination&lt;/code&gt;. Pagination has some sub-props:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;data this can the name of the file inside the _data directory; in your case, it should be &lt;code&gt;pokemons&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;size where you can specify the size of the page it is usually 1&lt;/li&gt;
&lt;li&gt;alias, which will be the name of a current item in the list.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every page will need a unique slug to construct the final URL. You can achieve that by using the permalink property. You can use the pokemon.name and pass it through the &lt;code&gt;slug&lt;/code&gt; eleventy filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;--------
pagination:
  data: pokemons
  size: 1
  alias: pokemon
permalink: "pokemons/{{ pokemon.name | slug}}/"
tags: pokemonPage
title: {{ pokemon.name }}
--------
&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt; Name: {{ pokemon.name }} &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt; Power: {{ pokemon.power }} &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Where to go from here
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure to check the &lt;a href="https://www.11ty.dev/"&gt;11ty documentation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://app.egghead.io/playlists/getting-started-with-eleventy-53c2?af=eq272d"&gt;Eghead.io 11ty playlist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://realworldjamstack.dev/"&gt;realworldjamstack course&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>4 ways to use Axios interceptors</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Sun, 31 Jan 2021 10:02:36 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/4-ways-to-use-axios-interceptors-2hnj</link>
      <guid>https://dev.to/khaled_garbaya/4-ways-to-use-axios-interceptors-2hnj</guid>
      <description>&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%2Fimages.ctfassets.net%2F3bc97k4uk5q7%2F5nVOM5g4KVnas4Yu7u7EXn%2Fdf1acdbad3d40a417d8077bacf2adf12%2Fg70a7545352e758468fe6b01ed47e86fa7c4496a46650169e660886d2d5b3fb492502eda7e5920ac6297b4c5458499a4f_1280.jpg%3Fw%3D740" 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%2Fimages.ctfassets.net%2F3bc97k4uk5q7%2F5nVOM5g4KVnas4Yu7u7EXn%2Fdf1acdbad3d40a417d8077bacf2adf12%2Fg70a7545352e758468fe6b01ed47e86fa7c4496a46650169e660886d2d5b3fb492502eda7e5920ac6297b4c5458499a4f_1280.jpg%3Fw%3D740" alt="rg45 wires - credit ElasticComputeFarm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Axios?
&lt;/h2&gt;

&lt;p&gt;Axios is a promise-based HTTP client for the browser and node.js. It comes with many useful defaults like automatically detecting JSON responses and returning an object instead of plain text, throwing an error if the response status code is greater than 400.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an axios interceptor?
&lt;/h2&gt;

&lt;p&gt;An Axios &lt;a href="https://github.com/axios/axios#interceptors" rel="noopener noreferrer"&gt;interceptor&lt;/a&gt; is a function that the library calls every time it sends or receives the request. You can intercept requests or responses before they are handled by “then” or “catch”.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Add a request interceptor&lt;/span&gt;
&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Do something before request is sent&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Do something with request error&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Add a response interceptor&lt;/span&gt;
&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Any status code that lie within the range of 2xx cause this function to trigger&lt;/span&gt;
    &lt;span class="c1"&gt;// Do something with response data&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Any status codes that falls outside the range of 2xx cause this function to trigger&lt;/span&gt;
    &lt;span class="c1"&gt;// Do something with response error&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also remove the interceptor from Axios.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myInterceptor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="cm"&gt;/*...*/&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myInterceptor&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Inject auth token header in every request using interceptors
&lt;/h2&gt;

&lt;p&gt;There is a big chance when building an app that you will use an API that requires some credentials like api_token or a user Auth token. Usually, you will have to append the required headers with every HTTP request you make. Using Axios interceptors, you can set this up once, and anywhere you call your Axios instance, you are sure that the token is there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// `req` is the Axios request config, so you can modify&lt;/span&gt;
  &lt;span class="c1"&gt;// the `headers`.&lt;/span&gt;
  &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;authorization&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Bearer&lt;/span&gt; &lt;span class="nx"&gt;mytoken&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Automatically sets the authorization header because&lt;/span&gt;
&lt;span class="c1"&gt;// of the request interceptor&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//api.example.com’);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Log every request and response using interceptors.
&lt;/h2&gt;

&lt;p&gt;Logging requests can be beneficial, especially when you have a large app and you don’t know where all your requests are triggered. Using an Axios interceptor, you can log every request and response quickly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// you must return the request object after you are done&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// you must return the response object after you are done&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//example.com/‘);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error handling using Axios interceptors
&lt;/h2&gt;

&lt;p&gt;You can use An Axios interceptor to capture all errors and enhance them before reaching your end user. If you use multiple APIs with different error object shapes, you can use an interceptor to transform them into a standard structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//example.com/notfound’).&lt;/span&gt;
  &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// “Could not find page /notfound”&lt;/span&gt;
&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add rate limiting to requests using interceptors.
&lt;/h2&gt;

&lt;p&gt;Backend resources are limited and can cost a lot of money. As a client, you help reduce the load on your server by rate-limiting your HTTP calls. Here’s how you can do it using an Axios interceptor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lodash.debounce&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;// only fire a request every 2 sec&lt;/span&gt;
       &lt;span class="nf"&gt;debounce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>node</category>
      <category>webdev</category>
    </item>
    <item>
      <title>My new mac setup for web development in 2021</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Tue, 19 Jan 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/my-new-mac-setup-for-web-development-in-2021-3ig8</link>
      <guid>https://dev.to/khaled_garbaya/my-new-mac-setup-for-web-development-in-2021-3ig8</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1zHNGy4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/nOTp7eXjVz1h9urs8a7Ry/02d78aa2ad41dcef3706e669333488ac/messy-desk.png%3Fq%3D60" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1zHNGy4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/nOTp7eXjVz1h9urs8a7Ry/02d78aa2ad41dcef3706e669333488ac/messy-desk.png%3Fq%3D60" alt="A messy Desk"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I recently got a new mac and decided to set it up from scratch. In this blog post, you get a detailed list of all the tools I installed to help me with my day to day web development tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't you have a dotfile?
&lt;/h2&gt;

&lt;p&gt;I do have two dotfiles repo, but they kind of fall behind and are outdated. Also, I was not 100% satisfied with my setup, so I decide to start with a clean slate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the foundation
&lt;/h2&gt;

&lt;p&gt;First thing, you will need a password manager. With a new computer, you will need to log in to many services, like Github, email, etc., so it is better to set up your password manager first. I use &lt;a href="https://1password.com/downloads/mac/"&gt;1Password&lt;/a&gt; as my primary password manager.&lt;/p&gt;

&lt;p&gt;Second, to make your life easier, get a package manager for your mac; I am talking about &lt;a href="https://brew.sh/"&gt;brew&lt;/a&gt;. It will allow you to install 90% of your tools through the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Terminal setup
&lt;/h2&gt;

&lt;p&gt;Now iTerm2, a terminal emulator, this a personal choice, and feel free to install anything else you want or use the default mac terminal, which I did btw for over two years.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install --cask iterm2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Continuing with iterm2, I love the night owl theme for both my &lt;a href="https://github.com/nickcernis/iterm2-night-owl"&gt;terminal&lt;/a&gt; and my code editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nYdqxZix--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/4i7Kxl6b5P8IUmDFSJeMsF/7c4e04b41fbb85ef7a5d13200972fdb0/Screen_Shot_2020-12-29_at_21.55.14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nYdqxZix--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/4i7Kxl6b5P8IUmDFSJeMsF/7c4e04b41fbb85ef7a5d13200972fdb0/Screen_Shot_2020-12-29_at_21.55.14.png" alt="iterm-nightownl"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another setting you might want to change is to set the appearance to minimal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vnIi-U5W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/42RVchJ2nm27ZfyufC5uax/965fa03b8a2bdda07ff5120dc1970175/Screen_Shot_2020-12-29_at_21.58.38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vnIi-U5W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/42RVchJ2nm27ZfyufC5uax/965fa03b8a2bdda07ff5120dc1970175/Screen_Shot_2020-12-29_at_21.58.38.png" alt="iterm-settings-minimal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even more terminal goodness, let's install &lt;a href="https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH"&gt;zsh&lt;/a&gt; &lt;a href="https://github.com/ohmyzsh/ohmyzsh"&gt;oh-my-zsh&lt;/a&gt; this will help you take your terminal to the next level with things like history and autocomplete. So no more "what was that command again".&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the Node environment
&lt;/h2&gt;

&lt;p&gt;For Node js, I use a node version manager, &lt;code&gt;nvm.&lt;/code&gt; This allows me to install different versions of nodejs and switch between them from the terminal. to install nvm, you can use &lt;code&gt;brew&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sh brew install nvm mkdir ~/.nvm nvm install stable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the node package manager, npm already comes bundled with nodejs, but sometimes I might need yarn so let's install it using brew.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install yarn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setup git and source control
&lt;/h2&gt;

&lt;p&gt;I use Github to host all my repositories if you follow this &lt;a href="https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent"&gt;tutorial&lt;/a&gt; to set up an ssh key.&lt;/p&gt;

&lt;p&gt;Another important thing is to tell git who you are instead of getting random author details on your commit like &lt;a href="mailto:khaled@MBP"&gt;khaled@MBP&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config —global user.name "FIRST_NAME LAST_NAME."
git config —global user.email "you@domain.com."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You might want to install &lt;a href="https://github.com/github/hub"&gt;Github hub&lt;/a&gt;. Github hub will add some excellent features on top of git, like creating a repository from your terminal and starting a pull request directly from the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code editors and workflow
&lt;/h2&gt;

&lt;p&gt;For coding, I use mostly nvim and tmux because I love seeing everything in one window, something like this: &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--em11hN00--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/6WHnvv5AaXaiQrNNGE0IXJ/74b00c40b683e778385170820ef8600b/Screenshot_2021-01-18_at_21.41.20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--em11hN00--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/6WHnvv5AaXaiQrNNGE0IXJ/74b00c40b683e778385170820ef8600b/Screenshot_2021-01-18_at_21.41.20.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And I know I know vscode has an integrated terminal. With tmux, you can do more like zooming in on panel quickly do a task and zoom back and switch between multiple projects quickly using sessions inside the same terminal window.&lt;/p&gt;

&lt;p&gt;You can find all my nvim, tmux and coc configs &lt;a href="https://gist.github.com/Khaledgarbaya/420d680115988e3fb12313fff7afbb85"&gt;here&lt;/a&gt; there should be enough comments to explain things.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extras
&lt;/h2&gt;

&lt;p&gt;If you have an external monitor that is not supported officially by Apple, you can't control your monitor's brightness, contrast, or volume. Luckily there is a utility that you can install to fix that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install --cask monitorcontrol
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also use &lt;a href="https://www.alfredapp.com/"&gt;Alfred&lt;/a&gt;, a productivity App for mac. You can keepo your Alfred settings in sync between multiple computer using Dropbox, &lt;a href="https://www.alfredapp.com/blog/productivity/keep-in-sync-using-dropbox-with-alfred/"&gt;here's how to do it&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>2020 A year in review</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Sat, 19 Dec 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/2020-a-year-in-review-ogm</link>
      <guid>https://dev.to/khaled_garbaya/2020-a-year-in-review-ogm</guid>
      <description>&lt;p&gt;&lt;a href="//images.ctfassets.net/3bc97k4uk5q7/3TKaxlmwylOSi524hGqN7G/bd172f8d6aa5b831225e58be00ca4591/57e5dd434857a914f6d1867dda3536781537dae556527948_1920.jpg" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/3bc97k4uk5q7/3TKaxlmwylOSi524hGqN7G/bd172f8d6aa5b831225e58be00ca4591/57e5dd434857a914f6d1867dda3536781537dae556527948_1920.jpg" alt="man using telescope"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This year, 2020, was crazy, unusual, and maybe we will talk about it for years to come. I am very grateful that my family and I are safe. 2020 is also the year that we had our first baby, a lovely baby girl. Throughout the year, I’ve released a decent amount of educational content focusing more on the JAMstack.&lt;/p&gt;

&lt;h2&gt;
  
  
  TLDR;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Videos: 45 YouTube videos&lt;/li&gt;
&lt;li&gt;Blog posts: 3 blog posts&lt;/li&gt;
&lt;li&gt;Courses: 1 big course and four mini-courses/collections, a total of 28 videos&lt;/li&gt;
&lt;li&gt;Side Projects: &lt;a href="https://tldreact.dev"&gt;https://tldreact.dev&lt;/a&gt;, &lt;a href="https://learnjamstack.com"&gt;https://learnjamstack.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitch Streams: around 40+ stream&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Content I released
&lt;/h2&gt;

&lt;p&gt;My main focus was JAMstack and building a complete project from start to finish. Not the classic blog post or todo app but real-world saas Apps using Gatsbyjs, Netlify, Contentful, and the JAMstack friends.&lt;/p&gt;

&lt;p&gt;Most of the content was in the form of videos. I started the year with a challenge, pushing the JAMstack to its limit, so I started building a Saas App called &lt;a href="https://rubbergoose.de/"&gt;rubbergoose.dev&lt;/a&gt; . Throughout 23 streams, I created a complete App that uses Netlify Identity, Stripe, Twillio videos, and much more hot new tech. You can find all the videos in this YouTube &lt;a href="https://www.youtube.com/watch?v=yYqJWpV7HaI&amp;amp;list=PL8KiuH6vpACWZ7989jU1Puil5P2_m2O8e"&gt;playlist&lt;/a&gt; . The code is also opensource over at &lt;a href="https://github.com/Khaledgarbaya/rubbergoose"&gt;Github&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;Continuing with the live stream, I also did 13 random ones covering different topics like working on my &lt;a href="https://khaledgarbaya.net/"&gt;website&lt;/a&gt; , Setting up my dev environment, exploring other frameworks/tools like eleventy, Gatsby recipes, and answering some people’s questions about Contentful.&lt;/p&gt;

&lt;p&gt;Compared to video production, I did very poorly in writing blog posts, which I will try to improve in 2021 (famous last word). I wrote a piece about how to use &lt;a href="https://dev.to/khaled_garbaya/gatsby-as-a-replacement-for-create-react-app-2860"&gt;Gatsby as a replacement for create-react-app&lt;/a&gt; . The goal was not to talk about this vs. that but to showcase Gatsby’s power and how you can build real-world apps with it. The &lt;a href="https://dev.to/khaled_garbaya/getting-started-with-gatsbyjs-recipes-2g33"&gt;second blog post&lt;/a&gt; I wrote is a deep dive into Gatsby recipes and how you can create your own. Consider it the written version of my egghead &lt;a href="https://egghead.io/playlists/getting-started-with-gatsbyjs-recipes-c79a??af=eq272d"&gt;mini-course&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;Now courses, With the help of &lt;a href="https://egghead.io/"&gt;egghead.io&lt;/a&gt; , I produced the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://egghead.io/courses/eject-create-react-app-and-use-gatsby-for-advanced-react-app-development?af=eq272d"&gt;Eject create-react-app and Use Gatsby for Advanced React App Development&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://egghead.io/playlists/create-a-figma-plugin-16d5?af=eq272d"&gt;Create a Figma Plugin Using Typescript&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://egghead.io/playlists/getting-started-with-eleventy-53c2?af=eq272d"&gt;Getting Started with Eleventy&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://egghead.io/playlists/getting-started-with-gatsbyjs-recipes-c79a?af=eq272d"&gt;Getting Started with Gatsbyjs recipes&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://egghead.io/playlists/getting-started-with-blitz-js-0585?af=eq272d"&gt;Getting Started with Blitz.js&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Side projects
&lt;/h2&gt;

&lt;p&gt;I probably start 34897 side projects, but I will talk only about the ones I released.&lt;/p&gt;

&lt;p&gt;I released &lt;a href="https://learnjamstack.com/"&gt;learnjamstack&lt;/a&gt; , a curated list of courses, articles, and tips about JAMstack.The main thing you get from this project is a weekly email with great jamstack resources, or what I thought is cool.&lt;/p&gt;

&lt;p&gt;I released &lt;a href="https://tldreact.dev/"&gt;tldreact.dev&lt;/a&gt; , quick and easy React snippets that you’re always looking for but never find. Most of the time, when working with React, I find myself scanning a tutorial directly for the code and skipping all the explanations and fluff because I don’t need it, so I made tldreact.dev just for that use case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to go from here
&lt;/h2&gt;

&lt;p&gt;Do you want to keep an eye on what I will release next? Subscribe to my &lt;a href="https://khaledgarbaya.net/newsletter"&gt;newsletter&lt;/a&gt; and subscribe to my &lt;a href="https://youtube.com/kgarbaya"&gt;YouTube channel&lt;/a&gt; .&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Getting Started with Gatsbyjs recipes</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Sat, 02 May 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/getting-started-with-gatsbyjs-recipes-2g33</link>
      <guid>https://dev.to/khaled_garbaya/getting-started-with-gatsbyjs-recipes-2g33</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hQJ-rKjs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/6YCqp8RE8bJPDavNgLCOmN/aadf17c6de2d57fa3af3e95a70fea0a5/ingredients-498199_1920.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hQJ-rKjs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/6YCqp8RE8bJPDavNgLCOmN/aadf17c6de2d57fa3af3e95a70fea0a5/ingredients-498199_1920.jpg" alt="ingredients"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Gatsby ecosystem is prosperous with plugins and themes, which I love, but sometimes it becomes a problem when trying to assemble all the pieces to achieve your goal.&lt;/p&gt;

&lt;p&gt;For a long time, proper documentation was the solution, but it is hard to keep up to date and copy-pasting commands into your terminal without understanding what they do. It becomes a tedious process.&lt;/p&gt;

&lt;p&gt;Wouldn't it be nice if you could make the setup instructions more interactive? Where people can read through it and set up their projects at the same time.&lt;/p&gt;

&lt;p&gt;Enter: Gatsbyjs Recipes&lt;/p&gt;

&lt;p&gt;Gatsbyjs Recipes are run from the CLI and automate common tasks like creating pages and layouts, installing and setting up plugins, adding a blog to a site, setting up Typescript, and many more.With the release of this new feature, Gatsby has created 11 official recipes that you can explore, including ThemeUI, Sass, Cypress, animated page transitions, and persistent layout components.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Gatsby recipe?
&lt;/h2&gt;

&lt;p&gt;Recipes are written in MDX—a combination of Markdown and React components—readable by both humans and machines. (Other "infrastructure as code" automation, like AWS CloudFormation, use kinda-sorta legible YAML templates that favor the machines).&lt;/p&gt;

&lt;p&gt;MDX is a great choice here because it makes Gatsby Recipes instructions and explanations easily readable for humans while using React components syntax to declare to Gatsby Recipes the desired state of the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set up Gatsby to use Recipes
&lt;/h2&gt;

&lt;p&gt;To be able to use recipes, you need to install the latest gatsby-cli &lt;code&gt;yarn global add gatsby-cli@latest&lt;/code&gt;. Also, make sure to upgrade your project to use the latest gatsby by running the command &lt;code&gt;yarn upgrade --latest&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To test if everything is working as expected, run &lt;code&gt;gatsby recipes&lt;/code&gt;, and you should see a list of the official recipes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install NPM packages Using a Gatsby Recipe
&lt;/h2&gt;

&lt;p&gt;To create a recipe, we need first to create an MDX file. You can create it anywhere. It doesn't need to be part of a Gatsby project.Let's take setting up tailwindcss with Gatsby as an example.Create a file called tailwindcss.mdx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Setup Gatsby with tailwindcss

[Tailwindcss](https://tailwindcss.com/) Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override.

--------

Install npm packages

&amp;lt;NPMPackage name="tailwindcss"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We started with a Head and some text to explain what the recipe does and using &lt;code&gt;---&lt;/code&gt; we mark the beginning of a new Step.Using the &lt;code&gt;NPMPackage&lt;/code&gt; block, we tell Gatsby that it's time to install a dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add a Gatsby Plugin using a Gatsbyjs Recipe
&lt;/h2&gt;

&lt;p&gt;To add a gatsby plugin using a recipe, you need to use both the &lt;code&gt;NPMPackage&lt;/code&gt; block with the &lt;code&gt;GatsbyPlugin&lt;/code&gt; block.Our tailwindcss.mdx file looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Setup Gatsby with tailwind

[Tailwindcss](https://tailwindcss.com/) Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override.

--------

Install npm packages

&amp;lt;NPMPackage name="tailwindcss"/&amp;gt;

--------

Add a Gatsby Plugin

&amp;lt;NPMPackage name="gatsby-plugin-postcss" /&amp;gt;
&amp;lt;GatsbyPlugin name="gatsby-plugin-postcss" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add Files using a Gatsby Recipe.
&lt;/h2&gt;

&lt;p&gt;You can also create files in your Gatsby project using recipes.In my case, I need to create 3 files:postcss.config.js to pass some configuration to postcsstailwind.css to import the tailwindcss componentsusingtailwind.js, a gatsby page to test if everything is workingUsing the &lt;code&gt;File&lt;/code&gt; block, you can specify the path, where you want to create the file, and the content, which is usually a link to a gist with some text content.&lt;/p&gt;

&lt;p&gt;Our tailwindcss.mdx file looks like this now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Setup Gatsby with tailwind

[Tailwindcss](https://tailwindcss.com/) Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override.

--------

Install npm packages

&amp;lt;NPMPackage name="tailwindcss"/&amp;gt;

--------

Add a Gatsby Plugin

&amp;lt;NPMPackage name="gatsby-plugin-postcss" /&amp;gt;
&amp;lt;GatsbyPlugin name="gatsby-plugin-postcss" /&amp;gt;

--------

Add some files

&amp;lt;File path="postcss.config.js" content="https://raw.githubusercontent.com/Khaledgarbaya/gatsby-tailwindcss-recipe/master/postcss.config.js"/&amp;gt;

&amp;lt;File
  path="tailwind.config.js"
  content="https://raw.githubusercontent.com/Khaledgarbaya/gatsby-tailwindcss-recipe/master/tailwind.config.js"
/&amp;gt;

&amp;lt;File
  path="src/styles/tailwind.css"
  content="https://raw.githubusercontent.com/Khaledgarbaya/gatsby-tailwindcss-recipe/master/src/styles/tailwind.css"
/&amp;gt;

&amp;lt;File
  path="src/pages/usingtailwind.js"
  content="https://raw.githubusercontent.com/Khaledgarbaya/gatsby-tailwindcss-recipe/master/src/pages/tailwind.js"
/&amp;gt;

--------

Done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Where to go from here
&lt;/h2&gt;

&lt;p&gt;Make sure to check out the official &lt;a href="https://www.gatsbyjs.org/blog/2020-04-15-announcing-gatsby-recipes/"&gt;blog post&lt;/a&gt; by Gatsby and visit the &lt;a href="https://github.com/gatsbyjs/gatsby/issues/22991"&gt;Umbrella issue&lt;/a&gt; if you want to contribute&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Gatsby As a Replacement for Create-react-app</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Wed, 01 Jan 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/gatsby-as-a-replacement-for-create-react-app-2860</link>
      <guid>https://dev.to/khaled_garbaya/gatsby-as-a-replacement-for-create-react-app-2860</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LC13VUTX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/3rigB437ZRKags2jDaFCwj/94b75ef5febe9afdf02d475a39e441f8/react-to-gatsby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LC13VUTX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.ctfassets.net/3bc97k4uk5q7/3rigB437ZRKags2jDaFCwj/94b75ef5febe9afdf02d475a39e441f8/react-to-gatsby.png" alt="react-to-gatsby"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gatsbyjs and create-react-app are similar in that can help you set up application and removes much of the configuration headache. However, Gatsby offers more like backed in performance optimizations and static rendering without the need for a server and a thriving ecosystem of plugins.&lt;/p&gt;

&lt;p&gt;You might ask me "Isn't Gatsby a static site generator?".&lt;/p&gt;

&lt;p&gt;The Answer is Yes But it offers more than that. It gives you HTML to start with then, rehydrates it into a fully-fledged React app&lt;/p&gt;

&lt;h2&gt;
  
  
  CRA VS Gatsby
&lt;/h2&gt;

&lt;p&gt;They are similar, they work perfectly with React, they help you setup an application and they remove the configuration headache.&lt;/p&gt;

&lt;h2&gt;
  
  
  However...Gatsby Offers More
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Zero config performance optimazations
&lt;/h3&gt;

&lt;p&gt;GatsbyJS provides code and data splitting out-of-the-box. It loads your critical HTML and CSS, then prefetches resources for other pages. That way, clicking around feels so fast. Additionally, it offers things like:&lt;/p&gt;

&lt;p&gt;gatsby-link uses an intersection observer to preload linked pages when they appear in the viewport, making them feel like they load instantlygatsby-image creates optimized versions of your images in Different sizes, loading a smaller, optimized version of an image and replacing it with a higher resolution version when loading has finished. It also uses an intersection observer to cheaply lazy load images.&lt;/p&gt;

&lt;p&gt;Server side rendering without a serverAt build time, GatsbyJS takes all your react component with all the needed data and generates static HTML, JavaScript, and CSS files. Once the website is fully loaded it rehydrates it into a fully fledge React PWA&lt;/p&gt;

&lt;h3&gt;
  
  
  A Unified GraphQL Data Layer
&lt;/h3&gt;

&lt;p&gt;GatsbyJS unifies all data sources into one layer using GraphQL&lt;/p&gt;

&lt;h3&gt;
  
  
  A rich plugin ecosystem
&lt;/h3&gt;

&lt;p&gt;With GatsbyJS's flexible plugin system, it lets you bring your data source. From anywhere like CMS, database, or filesystem and makes it queriable through GraphQL.&lt;/p&gt;

&lt;h3&gt;
  
  
  A few Gotcha
&lt;/h3&gt;

&lt;p&gt;The window ObjectIf one of your react components relies on the window object it will cause a problem when you are building the Gatsby app because the ssr step runs on a node environment. Luckily you can workaround that using the following check&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const isBrowser = typeof window !== "undefined"

exports.onCreateWebpackConfig = ({ stage, loaders, actions }) =&amp;gt; {
  if (stage === "build-html") {
    actions.setWebpackConfig({
      module: {
        rules: [
          {
            test: /bad-module/,
            use: loaders.null(),
          },
        ],
      },
    })
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  You can use Gatsby without Graphql
&lt;/h3&gt;

&lt;p&gt;Although Gatsby marries React and Graphql nicely you don't have to use GraphQL if you don't want to.&lt;/p&gt;

&lt;p&gt;Here is an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exports.createPages = async ({ actions: { createPage } }) =&amp;gt; {
  // `getPokemonData` is a function that fetches our data
  const allPokemon = await getPokemonData(["pikachu", "charizard", "squirtle"])
  // Create a page that lists all Pokémon.
  createPage({
    path: `/`,
    component: require.resolve("./src/templates/all-pokemon.js"),
    context: { allPokemon },
  })
  // Create a page for each Pokémon.
  allPokemon.forEach(pokemon =&amp;gt; {
    createPage({
      path: `/pokemon/${pokemon.name}/`,
      component: require.resolve("./src/templates/pokemon.js"),
      context: { pokemon },
    })
  })
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Where to go from here
&lt;/h2&gt;

&lt;p&gt;I did a talk about the topic at Gatsby days London&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/kqtlCL6Btqw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can find the slides also &lt;a href="https://speakerdeck.com/kgarbaya/gatsby-as-a-replacement-for-create-react-app"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am about to launch my course "&lt;a href="https://learnjamstack.com/migrate-a-reactjs-project-to-gatsby"&gt;migrate a create-react-app project to Gatsby&lt;/a&gt;" which will go a lot deeper in the topic and provide a step by step Guide on how you can take your existing CRA project and turn it into a Gatsby App. You can check it out &lt;a href="https://learnjamstack.com/migrate-a-reactjs-project-to-gatsby"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;Khaled&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>gatsby</category>
    </item>
    <item>
      <title>Tl;Dr GraphQL</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Sun, 12 May 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/tl-dr-graphql-37dh</link>
      <guid>https://dev.to/khaled_garbaya/tl-dr-graphql-37dh</guid>
      <description>&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%2Fimages.ctfassets.net%2F3bc97k4uk5q7%2F1v5cJZ8FEDBgMSZMBcxUBy%2Fb40bd7f639fa9a5b86441738815d16ae%2F1_49DDRZhUWvVnH-QNHuSUSw.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%2Fimages.ctfassets.net%2F3bc97k4uk5q7%2F1v5cJZ8FEDBgMSZMBcxUBy%2Fb40bd7f639fa9a5b86441738815d16ae%2F1_49DDRZhUWvVnH-QNHuSUSw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is GraphQL?
&lt;/h2&gt;

&lt;p&gt;GraphQL is a query language for Your API, and a server-side runtime for executing your queries.It is not tied to any specific database engine it is up to you to resolve the query. To create a GraphQL service you define types and their fields, then provide functions for each field on each type.&lt;/p&gt;

&lt;h2&gt;
  
  
  GraphQL query language
&lt;/h2&gt;

&lt;p&gt;A GraphQL query looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[query][query name]{
     typeName {
        fieldName
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything inside the square brackets, &lt;code&gt;[&lt;/code&gt; and &lt;code&gt;]&lt;/code&gt; is optional.&lt;/p&gt;

&lt;p&gt;Example query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query getUserName{
    person {
       name 
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The return result will be something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  data: {
    person: {
       name: 'Jhon Snow' 
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fields
&lt;/h2&gt;

&lt;p&gt;GraphQL is about asking your service for specific fields from specific objects. For example: getting the name field from a user. The nice thing about GraphQL is the data you get is shaped exactly as the query.&lt;/p&gt;

&lt;p&gt;change this to table side by side&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
     person {
        name 
    }
}

{
  data: {
    person: {
       name: 'Jhon Snow' 
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A field can also refer an Object or a collection of Objects, for example let say every person in the database can have a pet. The query will look like this:change this to table side by side&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
     person {
        name 
        pet {
          name
       }
    }
}

{
  data: {
    person: {
       name: 'Jhon Snow',
       path: {
          name: 'Doge'
       }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Arguments
&lt;/h2&gt;

&lt;p&gt;In GraphQL every field and nested object can get its own set of arguments, this is very powerful, and sets GraphQL from REST apart.&lt;/p&gt;

&lt;p&gt;So let's evolve our previous query a bit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  person(id:'kdlhh123hf3tzf') {
    name
    height (unit: METER)
    pet{
      name
      age(format: DOG_YEARS)
    }
  }
}

{
  data: {
    person: {
       name: 'Jhon Snow',
       # 183 cm
       height: 183
       pet: {
          name: 'Doge',
          age: 7
       }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me explain the previous query.I told my service to get the user with the id &lt;code&gt;kdlhh123hf3tzf&lt;/code&gt; with the fields name and the height in meter. Using arguments you can specify things like the format of the field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aliases
&lt;/h2&gt;

&lt;p&gt;Let's take this example query&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query getUsers {
  users(role: admin) {
    id
    firstName
    lastName
    phone
    username
  }
  users(role: accountant) {
    id
    firstName
    lastName
      phone
    username
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Graphql will give us an error&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "errors": [
    {
      "message": "Fields \"users\" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.",
      "locations": [
        {
          "line": 2,
          "column": 3
        },
        {
          "line": 9,
          "column": 3
        }
      ]
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's because we can't use the same node name twice similar to json. To solve that we can use GraphQL Aliases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query getUsers {
  admins: users(role: admin) {
    id
    firstName
    lastName
    phone
    username
  }
  accountants: users(role: accountant) {
    id
    firstName
    lastName
    phone
    username
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the result of this query will be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  data: {
    admins: [
      {
        id
        firstName: 'Will'
        lastName: 'Smith'
        phone: '+0912323132'
        username: 'willy'
      }
    ],
    accountants: [
      {
        id
        firstName: 'Hannah'
        lastName: 'Smith'
        phone: '+0912323132'
        username: 'hannah'
      }
    ],

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fragments
&lt;/h2&gt;

&lt;p&gt;A graphql auery can get very verbose and Mainly because you need to provide every field you want to pull from your graphql endpoint.Using Graphql Fragment you can reuse pieces of query logic accross multiple queries.We can improve our previous query using fragment like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fragment UserInfo on User {
   id
   firstName
   lastName
   phone
   username
}

query getUsers {
  admins: users(role: admin) {
    ...UserInfo
  }
  accountants: users(role: accountant) {
    ...UserInfo
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What happened here is that we groupped the common fields on the User Object in a Fragment and we used it everytime we query for a user instead of writing the field names over and over again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to go from here
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to GraphQL &lt;a href="https://graphql.org/learn/" rel="noopener noreferrer"&gt;graphql.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;WTF is GraphQL &lt;a href="https://egghead.io/lessons/graphql-wtf-is-graphql" rel="noopener noreferrer"&gt;egghead.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>graphql</category>
    </item>
    <item>
      <title>How to style text with CSS | Couple Code Therapy</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Tue, 16 Oct 2018 20:11:26 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/how-to-style-text-with-css--couple-code-therapy-gm1</link>
      <guid>https://dev.to/khaled_garbaya/how-to-style-text-with-css--couple-code-therapy-gm1</guid>
      <description>&lt;p&gt;Hey Friends!&lt;/p&gt;

&lt;p&gt;We're back &lt;/p&gt;

&lt;p&gt;This is exciting, In Couple Code Therapy &lt;a href="https://anchor.fm/couple-code-therapy/episodes/How-to-style-text-with-CSS-e2cg2c"&gt;Episode Six&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Lovely partner continues using CSS to improve her website look and feel, We'll cover how to style text in detail&lt;/p&gt;

&lt;p&gt;Including :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mastering text styling with CSS. &lt;/li&gt;
&lt;li&gt;We'll go through all the basic fundamentals of text/font styling in detail, like setting font weight, family and style, text alignment, and other effects, and line and letter spacing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the &lt;a href="https://couplecodetherapy.com/therapies/how-to-style-text-in-css"&gt;show notes&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;Please let us know how we can improve to better teach basic web development&lt;/p&gt;

&lt;h4&gt;
  
  
  About the show:
&lt;/h4&gt;

&lt;p&gt;Couple Code Therapy! A new twist on learning web development…Where our brave coding expert host, tries to teach his beautiful, lovely, intelligent, and immaculate wife how to update her own website.&lt;br&gt;
It’s learning the basics of web development &amp;amp; coding – without being overwhelmed.&lt;/p&gt;

</description>
      <category>podcast</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>css</category>
    </item>
    <item>
      <title>How to style navigations and center containers in CSS | Couple Code Therapy</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Wed, 12 Sep 2018 11:15:34 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/how-to-style-navigations-and-center-containers-in-css--couple-code-therapy-5127</link>
      <guid>https://dev.to/khaled_garbaya/how-to-style-navigations-and-center-containers-in-css--couple-code-therapy-5127</guid>
      <description>&lt;p&gt;Hey Friends!&lt;/p&gt;

&lt;p&gt;This is exciting, In Couple Code Therapy &lt;a href="https://anchor.fm/couple-code-therapy/episodes/How-to-style-navigations-and-center-containers-in-CSS-e26q0d" rel="noopener noreferrer"&gt;Episode Five&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Lovely partner continues using CSS to improve her website look and feel, We'll cover how to style navigations in a website and some layout techniques to center containers&lt;/p&gt;

&lt;p&gt;Here's a preview of the progress&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FDmwmtj0XcAAd-tt.jpg%3Alarge" 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%2Fpbs.twimg.com%2Fmedia%2FDmwmtj0XcAAd-tt.jpg%3Alarge" alt="Couple code therapy Website example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'll cover :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to style navigations in CSS&lt;/li&gt;
&lt;li&gt;CSS layout techniques&lt;/li&gt;
&lt;li&gt;Make responsive containers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the &lt;a href="https://couplecodetherapy.com/therapies/how-to-style-navigations-and-center-containers-in-css" rel="noopener noreferrer"&gt;show notes&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;Please let us know how we can improve to better teach basic web development&lt;/p&gt;

&lt;h4&gt;
  
  
  About the show:
&lt;/h4&gt;

&lt;p&gt;Couple Code Therapy! A new twist on learning web development…Where our brave coding expert host, tries to teach his beautiful, lovely, intelligent, and immaculate wife how to update her own website.&lt;br&gt;
It’s learning the basics of web development &amp;amp; coding – without being overwhelmed.&lt;/p&gt;

</description>
      <category>podcast</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>css</category>
    </item>
    <item>
      <title>TLDR GraphQL?</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Mon, 10 Sep 2018 09:14:31 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/tldr-graphql-448g</link>
      <guid>https://dev.to/khaled_garbaya/tldr-graphql-448g</guid>
      <description>&lt;p&gt;Hey Friends, I am writing a Tl;Dr (Too long; Didn't read) blog post about Using GraphQL on the client side.&lt;br&gt;
Mainly for folks to get the information they want without getting overwhelmed with long documentation.&lt;/p&gt;

&lt;p&gt;I have a lot in mind to write about already, like basic querying, Fragments, arguments etc... and I would like you to help me with more information.&lt;/p&gt;

&lt;p&gt;What was the information you wished you knew when working with GraphQL and or you wished there was a better explanation for it?&lt;/p&gt;

&lt;p&gt;I am planning to post the blog post in the next 2 days&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Khaled&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>graphql</category>
    </item>
    <item>
      <title>The state of javascript Survey</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Fri, 07 Sep 2018 20:27:40 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/the-state-of-javascript-survey-1lob</link>
      <guid>https://dev.to/khaled_garbaya/the-state-of-javascript-survey-1lob</guid>
      <description>&lt;p&gt;Hey Friends,&lt;/p&gt;

&lt;p&gt;Please help fill in the &lt;a href="https://medium.com/@sachagreif/take-the-state-of-javascript-2018-survey-c43be2fcaa9"&gt;survey&lt;/a&gt; about the state of javascript 2018.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you’re not familiar, the survey covers all things JavaScript and tries to answer two main questions:&lt;/p&gt;

&lt;p&gt;Which up-and-coming tools are developers most excited about?&lt;br&gt;
Which tried-and-true technologies are developers most happy with?&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>survey</category>
    </item>
    <item>
      <title>Getting Started With CSS | Couple Code Therapy</title>
      <dc:creator>Khaled Garbaya</dc:creator>
      <pubDate>Wed, 05 Sep 2018 07:49:33 +0000</pubDate>
      <link>https://dev.to/khaled_garbaya/getting-started-with-css--couple-code-therapy-3om4</link>
      <guid>https://dev.to/khaled_garbaya/getting-started-with-css--couple-code-therapy-3om4</guid>
      <description>&lt;p&gt;Hey Friends!&lt;/p&gt;

&lt;p&gt;This is exciting, In Couple Code Therapy &lt;a href="https://anchor.fm/couple-code-therapy/episodes/Getting-Started-with-CSS-e257pc"&gt;Episode Four&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Lovely partner Starts using CSS to style some HTML elements, She was so happy that she can finally make her Website more colorful.&lt;/p&gt;

&lt;p&gt;We'll cover :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to include CSS in your page&lt;/li&gt;
&lt;li&gt;CSS Selector&lt;/li&gt;
&lt;li&gt;CSS specificities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the &lt;a href="https://couplecodetherapy.com/therapies/getting-started-with-css"&gt;show notes&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;Please let us know how we can improve to better teach basic web development&lt;/p&gt;

&lt;h4&gt;
  
  
  About the show:
&lt;/h4&gt;

&lt;p&gt;Couple Code Therapy! A new twist on learning web development…Where our brave coding expert host, tries to teach his beautiful, lovely, intelligent, and immaculate wife how to update her own website.&lt;br&gt;
It’s learning the basics of web development &amp;amp; coding – without being overwhelmed.&lt;/p&gt;

</description>
      <category>podcast</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>css</category>
    </item>
  </channel>
</rss>
