<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Grpc on inherent site</title>
		<link>https://inherently.xyz/tags/grpc/</link>
		<description>Recent content in Grpc on inherent site</description>
		<generator>Hugo</generator>
		<language>en-us</language>
			<lastBuildDate>Sun, 04 Apr 2021 17:33:02 +0300</lastBuildDate>
			<atom:link href="https://inherently.xyz/tags/grpc/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>REST Is Over</title>
				<link>https://inherently.xyz/blog/rest-is-over/</link>
				<pubDate>Sun, 04 Apr 2021 17:33:02 +0300</pubDate>
				<guid>https://inherently.xyz/blog/rest-is-over/</guid>
				<description>&lt;h2 id=&#34;web-apis-are-terrible&#34;&gt;Web APIs are terrible&lt;/h2&gt;&#xA;&lt;p&gt;After watching a talk a few months back about REST vs GraphQL and the history of APIs, I agreed with the speaker that the API is supposed to be a way of communication, a language of sorts.&#xA;In programming languages this codified way of communication is enforced by the compiler or the interpreter or the runtime.&#xA;If you write invalid code in the programming language of your choosing, it won&amp;rsquo;t work.&#xA;Something or other will complain or break and prevent you from miscommunicating.&#xA;This got me wondering APIs especially web ones are so bad.&lt;/p&gt;&#xA;&lt;h2 id=&#34;resting-comfortably&#34;&gt;RESTing comfortably&lt;/h2&gt;&#xA;&lt;p&gt;With the introduction of what we call REST nowadays, basically JSON over HTTP, it&amp;rsquo;s all too common for application to use this mode of communication.&#xA;How this is enforced in practice is very variable though.&#xA;From different path schemes, to the same HTTP verbs used for different purposes, to (invariably bad) ways to communicate from machine to machine what the API is, it&amp;rsquo;s all up in the air.&#xA;Most fairly complex things that have a REST API, don&amp;rsquo;t even expect you to use them by directly interacting with it but instead use client libraries.&#xA;This has been going on for about a decade or two and it seems things are changing.&#xA;Some thought that GraphQL would be the end of that and it&amp;rsquo;s a pretty good step up but adoption is nowhere near as high.&#xA;In general REST is the assumed default way to interact with something programmatically.&#xA;Should it be though? Is GraphQL the best replacement we&amp;rsquo;ve got? I don&amp;rsquo;t think so.&lt;/p&gt;&#xA;&lt;h2 id=&#34;grpcee-what-i-did-there&#34;&gt;gRPCee what I did there&lt;/h2&gt;&#xA;&lt;p&gt;A somewhat recent thing called gRPC started picking up steam.&#xA;Talks about it, articles about it, large software projects using it but not really prominent on the web.&#xA;With this nifty little thing after writing a file that describes what your program does, you can generate some ready to use code, write the logic and &lt;code&gt;grpc.Serve()&lt;/code&gt; to the moon.&#xA;Even better, anyone wanting to write a client in any of the many supported languages can generate the boilerplate for a client from the same definition file and start calling the functions of the server really easily.&#xA;I&amp;rsquo;m being a bit simplistic for the sake of brevity but it&amp;rsquo;s really cool, trust me. It&amp;rsquo;s also really fast.&#xA;Alright, it&amp;rsquo;s better than freshly baked bread apparently so why is it not used on the web?&#xA;Cause it&amp;rsquo;s only HTTP/2 and the support for that is pretty limited.&#xA;Fear not though, we&amp;rsquo;re going to circle back to our crusty old frenemy, REST.&lt;/p&gt;&#xA;&lt;p&gt;Support for REST is widespread and there is a webdev in every city block ready to POST some JSON to your endpoint.&#xA;So we can&amp;rsquo;t immediately get rid of the kludgy wart but what about giving pixel pushers some REST while service to service communication is improved?&#xA;You see, since definitions exist for what the service sends and receives, the types of all the things being passed around, it&amp;rsquo;s quite easy to use some simple annotations to auto-generate a REST API.&#xA;This doesn&amp;rsquo;t 100% fix the problems that exist but it does smooth over some parts of it.&#xA;Okay so that&amp;rsquo;s it? Not just that, since the API is standardized we can even auto-generate documentation for it!&#xA;OpenAPI (formerly Swagger) docs can be easily generated and served to potential downstream users of the API.&#xA;Brilliant I think.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Over the past few months I&amp;rsquo;ve been reading a lot about gRPC, grpc-gateway, different ideas and implementations, trying out quite a few of them but I&amp;rsquo;ve yet to see one that makes me super excited and go &amp;ldquo;Aha! this is The One&amp;rdquo; or whatever.&#xA;I could do a link dump of about 100-150 tabs that I have open but that would be tiring and essentially do nothing to help.&#xA;Currently I&amp;rsquo;ve been trying to decide among 2-3 options for how a service should be structured and such but I&amp;rsquo;m still testing out prototypes, haven&amp;rsquo;t reached any conclusions.&#xA;However, I hope this was a semi-educational read and got you a bit interested in the ecosystem.&#xA;That&amp;rsquo;s all for now, I hope you enjoyed reading.&lt;/p&gt;&#xA;&lt;h3 id=&#34;pardon-me&#34;&gt;pardon me&lt;/h3&gt;&#xA;&lt;p&gt;&lt;del&gt;check out the &lt;a href=&#34;https://inherently.xyz/tutorials/&#34;&gt;tutorials&lt;/a&gt; section for my Go REST API Part 2 coming soon&lt;/del&gt;&#xA;sorry, I had to :^)&lt;/p&gt;&#xA;</description>
			</item>
	</channel>
</rss>
