<?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 Ankit Hans on Medium]]></title>
        <description><![CDATA[Stories by Ankit Hans on Medium]]></description>
        <link>https://medium.com/@ankithans1947?source=rss-b16d7d677c59------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Ankit Hans on Medium</title>
            <link>https://medium.com/@ankithans1947?source=rss-b16d7d677c59------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 08:38:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ankithans1947/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[Halfway in Google Summer of Code]]></title>
            <link>https://ankithans1947.medium.com/halfway-in-google-summer-of-code-746760bcb1ef?source=rss-b16d7d677c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/746760bcb1ef</guid>
            <category><![CDATA[charmil]]></category>
            <category><![CDATA[gsoc2021]]></category>
            <category><![CDATA[aerogear]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <dc:creator><![CDATA[Ankit Hans]]></dc:creator>
            <pubDate>Mon, 19 Jul 2021 14:16:09 GMT</pubDate>
            <atom:updated>2021-07-19T14:16:09.841Z</atom:updated>
            <content:encoded><![CDATA[<p>How is google summer of code going with aerogears(RedHat)</p><h3>How is GSoC going?</h3><p>My experience with <strong>Google Summer of Code</strong> and my organisation <strong>Aerogear</strong>(JBoss) has been so great till now, learning new things everyday has really became a part of my life.</p><p>It has been almost 2 months since I got into the program, but it feels like tomorrow! When I started contributing or writing proposal, I was like zero in golang, but comparing then and now, it’s different. In this journey I got to know about some great concepts in golang and again many yet to be explored!</p><blockquote><em>My favorite part about the Google Summer of Code is you work on projects are are used or will be used in the industry, and this feeling makes you keep going. We have integrated some features and are planning to integrate </em><a href="https://github.com/aerogear/charmil"><em>Charmil framework</em></a><em> with the </em><a href="https://github.com/redhat-developer/app-services-cli/"><em>RHOAS</em></a><em> and </em><a href="https://github.com/Apicurio/apicurio-cli"><em>Apicurio</em></a><em> CLI’s.</em></blockquote><p>Need to achieve much bigger targets/goals in coming coding period! Let’s hope for the best 🤞</p><h3>Again and Refined — What is Charmil?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*LN9O7prntGQPT_EM.png" /></figure><p>I have talked about Charmil ie. my GSoC project, in my previous blog, but this framework keeps on refining each day and there are some info’s that needs to be updated.</p><blockquote><em>So </em><strong><em>Charmil is a Framework for building command line plugins on the top of Cobra Golang library</em></strong><em>.</em></blockquote><p>Cobra is standard and very famous in the CLI industry and is being used in many industry projects such as Kubernetes, rhoas, gh-cli, etc. To make the development process easier we introduced Charmil.</p><p>Charmil solves many problems/issues faced by developers during development of CLI’s. The major feature that Charmil brings on the table is the <strong>ability to develop multiple fragmented CLI’s, maintained/working in separate repositories, and later embed/combine them in a single Host CLI</strong>.</p><h3>Charmil Components in brief</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*6zfS5FIwDnkTk_7T.png" /></figure><ul><li><strong>Charmil SDK</strong> — For building mutlirepo CLI’s</li><li><strong>Charmil Validator</strong> — Cobra Testing Library</li><li><strong>Charmil CLI</strong> — Creating starter and managing CLI project</li><li><strong>Charmil Command Registry</strong> — Install CLI plugins with binary from maintained registry</li></ul><p><em>For detailed description visit </em><a href="https://github.com/aerogear/charmil"><em>Charmil</em></a></p><h3>Charmil Validator</h3><p>This is the charmil library for <strong>testing and controlling many aspects of cobra commands</strong>. Like to test react components we have react-testing-library, similar to that to test cobra commands with some given set of customizable rules, we have charmil validator.</p><p>Validator provides a customizable set of config attributes, for example -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b123923eebc36c6269a169c10f6b6d58/href">https://medium.com/media/b123923eebc36c6269a169c10f6b6d58/href</a></iframe><p><strong>Rules provided by validator</strong> -</p><ul><li>LengthRule</li><li>MustExistRule</li><li>UseMatchesRule</li><li>ExampleMatchesRule</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8147aee3924eb35e8de3189345219caa/href">https://medium.com/media/8147aee3924eb35e8de3189345219caa/href</a></iframe><p>It is recommended to use Charmil Validator while writing unit tests for the cobra commands. Validator can check if the commands are <strong>providing proper and latest documentation</strong>, <strong>length and presence of attributes</strong>, <strong>regex matching for command names</strong> etc. It also provides the feature to <em>skip some command or skip including children for validation</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd8e8fe65974507dd50c599cba5a799e/href">https://medium.com/media/cd8e8fe65974507dd50c599cba5a799e/href</a></iframe><p>Skipping commands for validation is very easy. To skip a single command just provide the CommandPath and to skip the entire chain of commands(including subcommands/children) use a asterik sign immediately after CommandPath</p><p>Hence validator is very customizable and easy to use for developer productivity! For detailed documentation of charmil validator, visit <a href="https://github.com/aerogear/charmil/blob/main/docs/src/validator.md">Charmil Validator Docs</a></p><p>Here is a small diagram to show how is validator working under the hood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/0*NjIxBerYi5PIa0Fi.png" /></figure><h3>Would like to sync?</h3><ul><li>We are keeping all the communications open, so that everyone can sync and is free to contribute. So if you have any feature/bugs suggestions about anything please donot hesitate to open up an <a href="https://github.com/aerogear/charmil/issues/new">issue</a></li><li>You can join <a href="https://discord.gg/hsDJUPkAWH">Aerogear’s discord server</a> to participate in the discussions happening</li></ul><h3>GSoC Weekly</h3><p>I have been maintaining a <strong>Project Tracker</strong> to record the entire process in GSoC and making up of Charmil framework from scratch. Feel free to check it out at <a href="https://ankithans.github.io/gsoc21/">https://ankithans.github.io/gsoc21/</a></p><h3>What I have learnt or still learning</h3><p>Some of these I got from my mentor’s feedbacks and others are just my experiences</p><ul><li><strong>Communicate more and more</strong>, even if you are stuck somewhere for long. Communication is the key here</li><li><strong>Regularly push code</strong> and ask for reviews</li><li>Focus more on the end users and problems, not just code it first then think. Try to <strong>follow docs first approach</strong></li></ul><p><strong>Connect with me here</strong> — <a href="https://www.linkedin.com/in/ankithans/">LinkedIn</a> <a href="https://twitter.com/AnkitHans15">Twitter</a> <a href="https://github.com/ankithans">GitHub</a></p><ul><li>Again Communicate more before PR’s</li></ul><p><em>Originally published at </em><a href="https://ankithans.github.io/posts/2021/07/halfway-in-google-summer-of-code/"><em>https://ankithans.github.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=746760bcb1ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC’21 journey begins]]></title>
            <link>https://levelup.gitconnected.com/gsoc21-journey-begins-61da73cfa0fd?source=rss-b16d7d677c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/61da73cfa0fd</guid>
            <category><![CDATA[aerogear]]></category>
            <category><![CDATA[jboss]]></category>
            <category><![CDATA[gsoc2021]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[Ankit Hans]]></dc:creator>
            <pubDate>Fri, 11 Jun 2021 17:38:47 GMT</pubDate>
            <atom:updated>2021-06-11T18:32:27.245Z</atom:updated>
            <content:encoded><![CDATA[<p>Google Summer of Code 2021 starts with JBoss(Red Hat)</p><h3>Get started with open-source</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*Z1V45P8YKxC-Y4pY.png" /></figure><p>I myself started with <strong>opensource</strong> in end of the year 2020. Explored a lot of organizations, according to my interest and tech-stack. And I got a list of 20+ orgs, so I took my time, may be a week and gone through the projects of all of them. Then finally I found <a href="https://librehealth.io/">LibreHealth</a> and <a href="https://www.jboss.org/">JBoss</a>.</p><p>I started my opensource journey with <a href="https://librehealth.io/">LibreHealth</a>. The project was <a href="https://gitlab.com/librehealth/toolkit/cost-of-care/lh-toolkit-cost-of-care-app">Cost of Care Application</a> which aims to to provide patient friendly costs of care, to help patients get better cost estimates for medical procedures of Hospitals.</p><p>I knew <a href="https://flutter.dev/">flutter</a> before hand and so I did solve some issues and improvements. As I became active member in the <a href="https://forums.librehealth.io/">LibreHealth community</a> the admins gave me new user of the month badge, after some days they promoted my trust level on their forums and this really encouraged me to contribute more to open-source! The maintainers were quick in reviewing my merge requests and this filled me with confidence and persuaded me to apply for GSoC this year.</p><h3>How the Journey started with JBoss</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/0*cCZTlbamB-BKiLpI.png" /></figure><p>After a great kickstart in the journey of opensource, I found a project <a href="https://github.com/aerogear/graphql-link">graphql-link</a> in <strong>Aerogear(JBoss)</strong>. I knew that it was a Golang project overall(PS: I didn’t knew how to print hello world in golang), but there were some beginner friendly issues in the repository, like website for documentation( <a href="https://docusaurus.io/">docusaurus</a>), example servers etc.</p><p>I started resolving some good-first issues and got in touch with my mentor <a href="https://github.com/wtrocki">Wojciech Trocki</a>. He persuaded me to learn golang and contribute more. I am so glad to have a mentor like him. He helps in every way possible, like giving hints, code reviews, appreciations, guidance etc.</p><blockquote><strong><em>After my proposal got selected in JBoss, I got this from my mentor at LibreHealth</em></strong><em> and I was in seventh heaven 🤩🤩</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*JFx37WHko6c6UIWX.png" /></figure><h3>Open Source Projects</h3><p>There are typically two types of projects in open-source.</p><ol><li>The Project is already there on internet. You need to develop, propose and fix on the top of that.</li><li>The idea is validated on paper, but still it’s not on internet.</li></ol><p>My project comes in second category, I have to start everything from the ground level, deciding the architecture, code structure and documentation. In my opinion, this is a little harder to do than the projects in first category. You may think, you can decide the code structure and other things without any restrictions. But if you are not experienced enough then you might fail in doing this.</p><blockquote><em>The best way to decide design/architecture is -</em></blockquote><ul><li>get the thorough idea of the project, then try to think by yourself</li><li>show it to your mentor for validation</li><li>improve it from the feedbacks provided and repeat this cycle until you and your mentor is satisfied by the design.</li></ul><h3>About my Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y9pWMlUErjX8uGCP.png" /></figure><p>The project on which I will be working throughout this summer is . A Golang based Framework on the top of <a href="https://cobra.dev/">cobra</a> which will help the developers to create CLI’s as Plugins and later they can be installed/imported into any CLI. This can be achieved with a package manager similar to npm, apt, pip etc.</p><p>The user will import charmil in their CLI, which will provide them all the extensions out of the box. The user will be able to install specific plugins with the install command. After installing the extension, users will be able to use the features of that plugin without writing code for that particular feature which that plugin provides.</p><p>So it’s a SDK + CLI kind of stuff.</p><p>I cannot imagine working on something big like this own my own. That’s where <a href="https://summerofcode.withgoogle.com/">Google Summer of Code</a> gave me the platform and my mentors who are always there to support me.</p><h3>How is it going?</h3><p>I would say learning wise it’s going truly awesome, I learn new stuffs daily while working. <strong>Most important skill I got is plan before code.</strong> This really helps in using the time effectively. Whenever I am stuck, I like to write that up in notion or github(depends), and it always leads me from nowhere to somewhere.</p><h3>Week 1 report</h3><ul><li>Misunderstood some requirements of POC and explored how external CLI’s with binary can be used as plugins <a href="https://github.com/aerogear/charmil/pull/37">#37</a></li><li>Implemented correct wrapper approach according to the requirements <a href="https://github.com/aerogear/charmil/pull/45">#45</a></li><li>Compared how wrapper and 2nd(plugin’s use cobra) approaches are different, what do we loose/gain in wrapper approach <a href="https://github.com/aerogear/charmil/discussions/43#discussioncomment-851017">link</a></li></ul><h3>Next Week</h3><ul><li>Get the architecture of the final approach ready and move to 2nd phase</li><li>Decide specific initial features and start implementing and documenting</li></ul><h3>Blockers</h3><ul><li>What validation do we do when we implement other than wrapper approach?</li><li>Once the POC is ready then it should be easy to move with features</li></ul><h3>Open Source Projects vs Personal Projects</h3><p>There is huge debate on this topic on internet. But according to me, <strong>open-source projects are much more worth than personal projects</strong>. While working on OSS projects, you will be exploring the unknown code written by some engineer. You will collaborate with other open-source developers. Most of the project maintainers work full time in big tech companies and working with them will be a huge plus and you will get familiar with the industrial work.</p><p>All this above has been personally experienced by me in past months.</p><p>Connect with me here — <a href="https://www.linkedin.com/in/ankithans/">LinkedIn</a> <a href="https://twitter.com/AnkitHans15">Twitter</a> <a href="https://github.com/ankithans">Github</a></p><p><em>Originally published at </em><a href="https://ankithans.github.io/posts/2021/06/gsoc21-journey-begins/"><em>https://ankithans.github.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61da73cfa0fd" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/gsoc21-journey-begins-61da73cfa0fd">GSoC’21 journey begins</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Websites Like a pro]]></title>
            <link>https://levelup.gitconnected.com/deploy-websites-like-a-pro-e017f8e4e855?source=rss-b16d7d677c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e017f8e4e855</guid>
            <category><![CDATA[website]]></category>
            <category><![CDATA[surge]]></category>
            <category><![CDATA[static-websites]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[deploy]]></category>
            <dc:creator><![CDATA[Ankit Hans]]></dc:creator>
            <pubDate>Tue, 23 Mar 2021 08:51:36 GMT</pubDate>
            <atom:updated>2021-03-23T08:51:36.160Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Surge</strong> is static web publishing for Front-End Developers, right from the CLI, it’s free of cost and hassle-free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBQjEdOVnLq157gJng_kVw.jpeg" /></figure><p>To get started, you need to have node.js installed on your system. Then install surge globally by running the following command.</p><pre>npm install --g surge</pre><ol><li><strong>Open the directory in the terminal in which your static website is located</strong>. Like here I am deploying a react application, so I have to build it and go into the build folder.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*d3TNrtBaz1qjcHnDvfT3wA.png" /></figure><p>2.<strong> Now type </strong><strong>surge command in the terminal.</strong> If you are using surge for the first time, it will prompt for username and password. It will automatically register you to their servers.</p><p>3. It will ask for the folder path you wanna deploy and the domain name (you can enter any name which is not taken already).</p><p>4. <strong>If you want to enable </strong><strong>https</strong> (SSL security in the website), you just have to include https:// before the domain.</p><pre>https://&lt;domain&gt;.surge.sh</pre><p>Now Press Enter and your website will be live in some seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mGyB4IK_cSsbknoFwbtLrg.png" /></figure><p>Woohoo, 🎉 you have deployed your first website on <strong>surge.sh </strong>in seconds. Here is mine, check this out <a href="https://ankithans.surge.sh/">https://ankithans.surge.sh/</a></p><p>Connect with me -</p><ul><li><a href="https://linkedin.com/in/ankithans">Ankit Hans - Technical Team Member - Developer Student Clubs - SRM IST | LinkedIn</a></li><li><a href="https://github.com/ankithans">ankithans - Overview</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e017f8e4e855" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/deploy-websites-like-a-pro-e017f8e4e855">Deploy Websites Like a pro</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Server/API in Golang]]></title>
            <link>https://levelup.gitconnected.com/graphql-server-api-in-golang-601e41408d03?source=rss-b16d7d677c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/601e41408d03</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[graphql-vs-rest]]></category>
            <category><![CDATA[graphql-schema]]></category>
            <dc:creator><![CDATA[Ankit Hans]]></dc:creator>
            <pubDate>Fri, 19 Feb 2021 16:04:07 GMT</pubDate>
            <atom:updated>2021-03-07T02:30:12.265Z</atom:updated>
            <content:encoded><![CDATA[<p>GraphQL is an <strong>open-source query language</strong> for APIs and a runtime for fulfilling those queries with your existing data. <strong>Facebook’s mobile apps</strong> have been powered by GraphQL<strong> since 2012</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wP6QQGZ4pZ2yzb9b9G1asA.jpeg" /></figure><p>With GraphQL you can define the structure of the data as per client requirements. Hence <strong>Server declares what resources are available and the client asks for what it needs.</strong> You can get access to multiple resources in a single request or query. And One more thing <strong>it only has one endpoint, unlike the REST API.</strong> If you wanna learn more about REST API with Golang then go here :</p><p><a href="https://ankithans1947.medium.com/your-first-rest-api-in-golang-with-mux-b87a84746d00">Your First REST API in Golang (with mux)</a></p><p>Okay, So let’s get our initial setup done!</p><h3>Create a Github Repository</h3><p>to store our code and it will be also helping in initializing the Go modules. Choose the language as <strong>Go</strong> for <strong>.gitignore</strong> file. You may add a License or readme if you want.</p><p><strong>Clone the repo in your local System and open it in your favorite Code Editor.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*lMtOTU0rBbtfr_i3EjOMOA.png" /></figure><p>So here we are starting to code out our <strong>GraphQL API.</strong></p><h3>Step 1</h3><p>Now <strong>initialize Go modules</strong> in your project directory, by opening the folder in the terminal. You have to type</p><pre>go mod init github.com/&lt;YOUR_GITHUB_USERNAME&gt;/&lt;REPOSITORY_NAME&gt;</pre><p>In my case, it’s like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*PeWyIQ7kyNbLKohvRlaF_g.png" /></figure><h3>Step 2</h3><p>We are using <strong>gqlgen </strong>for setting up our GraphQL server. So install <strong>gqlgen </strong>into your project and init the GraphQL server.</p><pre>go get github.com/99designs/gqlgen<br>go run github.com/99designs/gqlgen init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5Fj6PVAOxAV5oNHJlaDWg.png" /></figure><p>The above steps will generate some code for you, that will have the following files and folders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G1m_Cn0el3tUod5Dkm0kfA.png" /></figure><p><strong>go.mod</strong> and <strong>go.sum</strong> will contain all your installed packages. <strong>gqlgen.yml</strong> file will have the autogenerated GraphQL configurations. <strong>server.go</strong> is the entry point to our server.</p><p>For this tutorial, you don&#39;t have to mess up with any files outside the graph folder 😀.</p><p>We will be creating a <strong>Characters API</strong>, in which users can <strong>add a character, search a character, and get all characters</strong>.</p><p>Now go into <strong>graph/schema.graphqls </strong>file. Clean the file and now we are going to define the GraphQL schema for the API. Below is the schema defined for the Characters API. We will be doing queries and mutations.</p><p><strong>Conventionally :</strong></p><ul><li>Query — for querying data (SELECT operations)</li><li>Mutation — for creating new and updating/deleting existing data (INSERT, UPDATE, DELETE)</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a36120a1b5bb5e1b01d98272162a96a6/href">https://medium.com/media/a36120a1b5bb5e1b01d98272162a96a6/href</a></iframe><p>Now delete <strong>graph/schema.resolvers.go . </strong>In <strong>resolver.go</strong> file add the following comment above the <strong>Resolver </strong>struct :</p><pre><strong>//go:generate go run github.com/99designs/gqlgen</strong><br>type Resolver struct{}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*QxCNY-nzZTY3QqYrK5tOkA.png" /></figure><p>This will auto-generate the code for our Schema that we have written in schema.graphqls . The next step is to delete <strong>schema.resolvers.go , </strong>so that <strong>gqlgen </strong>can generate code for our latest schema.</p><p>For Generating the code, go into the graph folder in the terminal and type :</p><pre>$ cd graph<br>$ go generate</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*PFM8TwLzmRiSNrgSRoAS_g.png" /></figure><p>You will be able to see the changes in some files. Your <strong>models_gen.go</strong> will look something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3xPKzsRQACAzSnp_KjnmSA.png" /></figure><p>And in <strong>schema.resolvers.go </strong>you will be seeing three unimplemented functions. And these are only those functions that we specified while writing GraphQL schema.</p><ol><li><strong>Add </strong>(add character)</li><li><strong>Characters </strong>(get all characters)</li><li><strong>Search </strong>(search character by name)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fJyIXHiDAvmaR3jCQVsdA.png" /></figure><p>Now we need to implement these functions and our API will be ready to test!</p><p>We will be using a <strong>fake database (slice)</strong> as our database. Slice is a dynamically sized array in Go.</p><p>To use that We have to add characters slice in our <strong>Resolver struct</strong> :</p><pre><strong>type Resolver struct {</strong></pre><pre><strong>       characters []*model.Character</strong></pre><pre><strong>}</strong></pre><p><strong>resolver.go</strong> file should look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*KBoKo1STDji8dN9e4jCKOg.png" /></figure><p>Then just we have to write the <strong>business logic of the API</strong> and we are done. Below are the changes to be done in functions of <strong>schema.resolvers.go </strong>file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14477b6f72497dd20e0b196e28deb769/href">https://medium.com/media/14477b6f72497dd20e0b196e28deb769/href</a></iframe><p>And yeah, we are officially done writing code. Let’s test our GraphQL API now! To run the server you have to go into the root directory where the project is located and type <strong>go run server.go</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*fliGw1oeeoJvi0AGOiRi-g.png" /></figure><p>Open <strong>http://localhost:8080/</strong> in your browser and you will see a beautiful user interface to interact with GraphQL API. <strong>Below is how you can write out queries and mutations in GraphQL to test it out!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBe8-WhikmLLPk9QHqGtug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVvgAOJE6cWtAmKfpeL4OA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DNLwpFFolQFAaywHIEjWEw.png" /></figure><p>So here finally you have created your first GraphQL API successfully. Hope you got to learn from it. Any doubts? hit me up in the comments. <strong>If you have reached this far, then do give this article a clap!</strong></p><p>Here are my socials, in case you wanna connect with me</p><ul><li><a href="https://github.com/ankithans">ankithans - Overview</a></li><li><a href="https://linkedin.com/in/ankithans">Ankit Hans - Technical Team Member - Developer Student Clubs - SRM IST | LinkedIn</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=601e41408d03" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/graphql-server-api-in-golang-601e41408d03">GraphQL Server/API in Golang</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your First REST API in Golang (with mux)]]></title>
            <link>https://levelup.gitconnected.com/your-first-rest-api-in-golang-with-mux-b87a84746d00?source=rss-b16d7d677c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/b87a84746d00</guid>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Ankit Hans]]></dc:creator>
            <pubDate>Thu, 18 Feb 2021 15:22:46 GMT</pubDate>
            <atom:updated>2021-02-23T12:49:32.447Z</atom:updated>
            <content:encoded><![CDATA[<h3>Your First <strong>REST API</strong> in Golang</h3><p><strong>Go</strong> was founded by <strong>2 google Software Engineers</strong>. The main Purpose that Golang fulfills is it <strong>combines the best of two worlds</strong> Java and C++.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DnnkReGamr7ps_2HlGT_FQ.png" /></figure><h4><strong>Prerequisites :</strong></h4><p>You Should be ideally using a Code Editor or IDE to write this API (Visual Studio Code, Sublime Text, Intellij, Atom, or any other)</p><ul><li><a href="https://code.visualstudio.com/download">Download Visual Studio Code - Mac, Linux, Windows</a></li><li><a href="https://golang.org/doc/install">Download and install - The Go Programming Language</a></li></ul><p>You must have Go installed on your System. Below are the steps as specified on the Go website.</p><ol><li>Go download</li><li>Go install</li><li>Go code</li></ol><blockquote>Let’s deep dive directly into code!</blockquote><h3><strong>1. Initialize Go Server:</strong></h3><p>Make a <strong>server.go</strong> file in the root directory of your folder. The contents for the same are given below.</p><p>Do <strong>go get github.com/gorilla/mux</strong> to install the mux package. We will be using mux as the HTTP router in this tutorial.</p><p>Below are the necessary imports, you will need in the implementation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a290a2a1dd0d0ffa04af563265e764f/href">https://medium.com/media/1a290a2a1dd0d0ffa04af563265e764f/href</a></iframe><p>Now let’s code our main function, the entry point for the Rest API.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31f07ba807e4a93c887a6597a5c9865b/href">https://medium.com/media/31f07ba807e4a93c887a6597a5c9865b/href</a></iframe><p>Now start the server by writing <strong>go run server.go </strong>and hit the endpoint <strong>http://localhost:8000</strong> on postman/browser.</p><p>Woohoo 💥💥, Congratulations your first Go server is up!</p><h3><strong>2. Setting up routes for adding and retrieving posts</strong></h3><p>we will be using a dummy database (an array) for the learning purpose. Let’s setup imports and our database in the server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9cce87c5a81e7cd92043fb08d858c4d/href">https://medium.com/media/e9cce87c5a81e7cd92043fb08d858c4d/href</a></iframe><p>For getting all the posts from fake DB (Slice)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a15aa0838efd75c1c1fe43eeb670fc12/href">https://medium.com/media/a15aa0838efd75c1c1fe43eeb670fc12/href</a></iframe><p>Add a post in the fake DB (Slice)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37747b531eda1d37c3960b2a74d1c573/href">https://medium.com/media/37747b531eda1d37c3960b2a74d1c573/href</a></iframe><p>Now, you are almost there to test your server. But wait, we haven’t used <strong>routes.go</strong> file anywhere. So the last step is to add the routes to the server.go file and link them with routers.</p><p>Add these two lines after / route</p><pre>router.HandleFunc(&quot;/posts&quot;, routes.GetPosts).Methods(&quot;GET&quot;) router.HandleFunc(&quot;/posts&quot;, routes.AddPost).Methods(&quot;POST&quot;)</pre><p>Finally your <strong>server.go</strong> file should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9275c8450568ab20daca8d90d1de797c/href">https://medium.com/media/9275c8450568ab20daca8d90d1de797c/href</a></iframe><p>And my friends, that&#39;s it! Let’s run our server again by typing the command in terminal <strong>go run main.go</strong></p><p>Now you can test your simple REST API using <strong>postman</strong>/<strong>Insomnia. </strong>You can use this in your upcoming project while connecting it with a real Database.</p><p>If you are into GraphQL, checkout -</p><p><a href="https://ankithans1947.medium.com/graphql-server-api-in-golang-601e41408d03">GraphQL Server/API in Golang</a></p><p>Here are my socials, in case you want to connect with me.</p><p><a href="https://twitter.com/AnkitHans15">https://twitter.com/AnkitHans15</a></p><ul><li><a href="https://github.com/ankithans">ankithans - Overview</a></li><li><a href="https://linkedin.com/in/ankithans">Ankit Hans - Technical Team Member - Developer Student Clubs - SRM IST | LinkedIn</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b87a84746d00" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/your-first-rest-api-in-golang-with-mux-b87a84746d00">Your First REST API in Golang (with mux)</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure WSL-2 in Windows]]></title>
            <link>https://medium.com/data-science-community-srm/wsl-2-configuration-b5f50b78c259?source=rss-b16d7d677c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5f50b78c259</guid>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Ankit Hans]]></dc:creator>
            <pubDate>Thu, 09 Jul 2020 12:18:12 GMT</pubDate>
            <atom:updated>2020-07-14T16:03:51.883Z</atom:updated>
            <content:encoded><![CDATA[<h3>Configuring WSL-2 in Windows</h3><h4>Do you want to use linux environment on your windows pc, here is the complete guide.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/0*IrPLw7uE7WWZT9ix.png" /><figcaption>Windows SubSystem for <strong>Linux</strong></figcaption></figure><p>The time has gone when <strong>Microsoft hated Linux</strong>, now they are partnering with <strong>canonical </strong>and other Linux platforms for optimizing <strong>WSL-2</strong> on windows platform. In future updates, we can also see <strong>Linux GUI </strong>applications directly running on windows as shown below. That&#39;s great news for Linux users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wvnQWME8IC-F7C1R.jpg" /><figcaption>Linux applications on windows</figcaption></figure><h3>Install the Windows Subsystem for Linux</h3><p>Before installing any Linux distro on windows, first, enable WSL-optional features. <em>Open Powershell as Administrator and run the following command. </em>After Entering the command Restart your pc.</p><pre>dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart</pre><h4>Enable the ‘Virtual Machine Platform’ optional component</h4><pre>dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart</pre><p>Again Restart your PC…</p><h4>Set WSL 2 as your default version</h4><pre>wsl --set-default-version 2</pre><h3>Install your Linux distribution of choice:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*McJro33xFiPRv1L9.png" /></figure><p>The following links will open the Microsoft store page for each distribution:</p><ul><li><a href="https://www.microsoft.com/store/apps/9pjn388hp8c9">Ubuntu 16.04 LTS</a></li><li><a href="https://www.microsoft.com/store/apps/9N9TNGVNDL3Q">Ubuntu 18.04 LTS</a></li><li><a href="https://www.microsoft.com/store/apps/9n6svws3rx71">Ubuntu 20.04 LTS</a></li><li><a href="https://www.microsoft.com/store/apps/9NJFZK00FGKV">openSUSE Leap 15.1</a></li><li><a href="https://www.microsoft.com/store/apps/9MZ3D1TRP8T1">SUSE Linux Enterprise Server 12 SP5</a></li><li><a href="https://www.microsoft.com/store/apps/9PN498VPMF3Z">SUSE Linux Enterprise Server 15 SP1</a></li><li><a href="https://www.microsoft.com/store/apps/9PKR34TNCV07">Kali Linux</a></li><li><a href="https://www.microsoft.com/store/apps/9MSVKQC78PK6">Debian GNU/Linux</a></li><li><a href="https://www.microsoft.com/store/apps/9n6gdm4k2hnc">Fedora Remix for WSL</a></li><li><a href="https://www.microsoft.com/store/apps/9NV1GV1PXZ6P">Pengwin</a></li><li><a href="https://www.microsoft.com/store/apps/9N8LP0X93VCP">Pengwin Enterprise</a></li><li><a href="https://www.microsoft.com/store/apps/9p804crf0395">Alpine WSL</a></li></ul><h4>Set up a new distribution</h4><p>The first time you will install a Linux it will ask you to create a Unix account just fillup your username and password and you are ready to use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VP5QMGqaymAQJyIw.png" /></figure><h3>Using Visual Studio Code with Windows Subsystem for Linux</h3><p>Visual Studio code supports wsl out of the box. You just have to install the vs-code extension “Remote WSL extension”. Then Just open command palette with ctrl + shift + p and type VS CODE-REMOTE you will see all of the VS Code Remote options available, allowing you to reopen the folder in a remote session, specify which distribution you want to open in, and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*RQMDsMWOnpD6hySr.png" /></figure><h3>Extensions inside of VS Code Remote</h3><p>While running VS-Code Remote, selecting the Extensions tab will split the list of extensions between the local machine and your WSL distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EyGQaz-_H9J1vLFD.png" /></figure><h3>Git on Windows Subsystem for Linux</h3><p>Git is the most useful version control system now. You can take the benefits of git in WSL also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H9hUizntxiI3mWKW.gif" /></figure><h3>Installing Git</h3><p>For Installing git on WSL you have to just run the below command.</p><pre>sudo apt-get install git</pre><h3>Git config file setup</h3><p>To set up your Git config file, open a command line for the distribution you’re working in and set your name with this command (replacing “Your Name” with your Git username) and Set your email with this command (replacing “youremail@domain.com” with the email you use on your Git account):</p><pre>`git config --global user.name &quot;Your Name&quot;`</pre><pre>`git config --global user.email &quot;<a href="/service/mailto:youremail@domain.com">youremail@domain.com</a>&quot;`</pre><p>That&#39;s it, folks, for now. You have successfully configured WSL-2 (Windows Subsystem for Linux) on your Windows 10 pc. Don’t forget to give a clap to the article.</p><p>Here is the official documentation from Microsoft for troubleshooting WSL</p><ul><li><a href="https://docs.microsoft.com/en-us/windows/wsl/">Windows Subsystem for Linux Documentation</a></li><li><a href="https://www.linkedin.com/in/ankithans">Ankit Hans - Mobile Application Developer - ISOLS Group Pvt Ltd | LinkedIn</a></li><li><a href="https://github.com/ankithans">ankithans - Overview</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5f50b78c259" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science-community-srm/wsl-2-configuration-b5f50b78c259">Configure WSL-2 in Windows</a> was originally published in <a href="https://medium.com/data-science-community-srm">DataX Journal</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>