<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joshua Swift on Medium]]></title>
        <description><![CDATA[Stories by Joshua Swift on Medium]]></description>
        <link>https://medium.com/@joshuaswift?source=rss-514dc2bb6d4f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-Obz_mfL4YLlzh3Qad4GDw.jpeg</url>
            <title>Stories by Joshua Swift on Medium</title>
            <link>https://medium.com/@joshuaswift?source=rss-514dc2bb6d4f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 20:32:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joshuaswift/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An Intro to GraphQL]]></title>
            <link>https://medium.com/@joshuaswift/an-intro-to-graphql-95d16cf739c3?source=rss-514dc2bb6d4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/95d16cf739c3</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[restful-api]]></category>
            <dc:creator><![CDATA[Joshua Swift]]></dc:creator>
            <pubDate>Fri, 31 May 2019 08:16:01 GMT</pubDate>
            <atom:updated>2019-05-31T08:16:01.924Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7ba5I_KEKKbw95SM" /><figcaption>Photo by <a href="https://unsplash.com/@foodiesfeed?utm_source=medium&amp;utm_medium=referral">Jakub Kapusnak</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’ve even got a passing interest in web technologies there’s a very good chance you’ve heard of GraphQL. It’s fair to say it’s taken the web development world by storm over the last couple of years and there’s a good reason why.</p><blockquote><em>GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data.</em></blockquote><p><em>Definition of GraphQL from the official site</em></p><p>Initially an internal project at Facebook, it’s now looked after by the Linux Foundation which ensures development on the technology can proceed without potential corporate hindrance.</p><h3>What’s so Great About GraphQL?</h3><p>So you may be wondering, what’s so great about GraphQL? And why is it different to what we have now?</p><p>To understand the benefits of GraphQL, it’s important to know the drawbacks of the current most widely used method of requesting data, REST (REpresentational State Transfer).</p><p>A ‘RESTful API’ is an API which uses HTTP methods (PUT, POST, DELETE, etc.) to send and request data.</p><p>RESTful APIs became extremely popular due to the fact they could be used with any platform or programming language without much difference in implementation. Due to this widespread adoption, REST then became the de facto standard when designing and building APIs, and for good reason!</p><p>However, there are drawbacks to RESTful APIs, namely that it’s very easy to over/under request data due to the way the data is structured.</p><h4>Apples to Apples</h4><p>The easiest way to summarise the differences between the 2 approaches is by using a simple analogy.</p><p>Imagine you go to your local greengrocer on a mission to buy some delicious crunchy apples. When you get there you can’t seem to find the apples anywhere, so you ask the friendly greengrocer if they can get you a kilo.</p><p><strong>RESTful API</strong></p><p>If the greengrocer was a RESTful API in this analogy, they would bring you back a big shopping trolley full of all the apples they had, you would then have to sort through the apples until you found your treasured Granny Smiths.</p><p><strong>GraphQL</strong></p><p>If the greengrocer was using GraphQL on the other hand, you could specifically request a kilo of Granny Smiths and the greengrocer would go off and fetch them for you. Service with a smile.</p><p>Requests to RESTful APIs are made via an endpoint, which usually looks something like this.</p><pre>GET https://friendlygreengrocer.com/apples/</pre><p>Each endpoint represents a different set of data, so if you need to request data from a number of areas, you would need to make multiple calls to different endpoints.</p><h3>How is GraphQL Different?</h3><p>The main difference GraphQL brings to the table is the fact you can request all your data inside a single query. This also gives the client more control over the data they request, as they can specify <strong>exactly</strong> which data they need. By design, this makes it nearly impossible to over/under request data!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d929c3c02cd3960cb3d5efa4d68d99cb/href">https://medium.com/media/d929c3c02cd3960cb3d5efa4d68d99cb/href</a></iframe><p>As you can see, with GraphQL all the information is contained inside one request which always goes to the same endpoint. So if you decide that you would like to retrieve some different data, you just add it to the existing request rather than making a new call to a completely different endpoint.</p><h3>Back-End Implementation</h3><p>We’ve now seen what a GraphQL request looks like on the front-end, but that’s only one piece of the puzzle. On the back-end, GraphQL is pretty much language agnostic, meaning you can implement it with any technology which allows you to build a web server. That means JavaScript, Ruby, Python, Java, Go, .NET and many more are all viable solutions!</p><p>There are in-depth tutorials for implementing GraphQL in most of these languages on the excellent How to GraphQL site.</p><p><a href="https://www.howtographql.com/">https://www.howtographql.com/</a></p><h3>The Drawbacks</h3><p>Even though I’ve been singing the praises of GraphQL, like any web technology there are times when it’s not the best tool for the job, and you may be best sticking with REST.</p><p>If your API is relatively simple and small with few endpoints, then the impact of switching to GraphQL will definitely be lessened. The fewer endpoints there are, the less chance you are over/under-fetching data, and there’s probably not going to be much of a performance boost.</p><p>There are also some <a href="https://nordicapis.com/security-points-to-consider-before-implementing-graphql/">concerns</a> over security and authorisation when using GraphQL. While these are mostly based on improper implementation and oversights, be mindful that these risks are present.</p><p>While GraphQL solves a lot of common problems with RESTful APIs, there are always tradeoffs, so before making the switch make sure you do some research to decide if it’s right for your project.</p><h3>Resources:</h3><p><a href="https://graphql.org/">https://graphql.org/</a></p><p><a href="https://goodapi.co/blog/rest-vs-graphql">REST vs. GraphQL: A Critical Review</a></p><p><a href="https://blog.logrocket.com/5-reasons-you-shouldnt-be-using-graphql-61c7846e7ed3">https://blog.logrocket.com/5-reasons-you-shouldnt-be-using-graphql-61c7846e7ed3</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95d16cf739c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>