<?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 Ian Duncan on Medium]]></title>
        <description><![CDATA[Stories by Ian Duncan on Medium]]></description>
        <link>https://medium.com/@ianduncan08?source=rss-6ae6d826295c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*n0cfxsppDTwie93-1VL9CQ.jpeg</url>
            <title>Stories by Ian Duncan on Medium</title>
            <link>https://medium.com/@ianduncan08?source=rss-6ae6d826295c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 12:36:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ianduncan08/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[Build a RESTful JSON API with GOlang]]></title>
            <link>https://medium.com/the-andela-way/build-a-restful-json-api-with-golang-85a83420c9da?source=rss-6ae6d826295c------2</link>
            <guid isPermaLink="false">https://medium.com/p/85a83420c9da</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[json-api]]></category>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ian Duncan]]></dc:creator>
            <pubDate>Mon, 03 Jun 2019 07:24:12 GMT</pubDate>
            <atom:updated>2019-06-03T22:11:22.771Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YIWeYQPpPm_bOwVP.png" /></figure><p>In this tutorial, we are creating an API that will allow users to create and view events. The final source code of what we will be creating can be found on <a href="https://github.com/Duncanian/go-rest-api">GitHub</a>.</p><h4><strong><em>Prerequisites</em></strong></h4><ul><li>We assume that you have GO installed already. If not, check it out <a href="https://golang.org/doc/install">here</a>.</li><li>After installing Go, you need to first be inside your GOPATH(The directory where all your Go projects will be kept). Your GOPATH will be set automatically once you have Go installed. In your GOPATH, you will have three folders bin, pkg and src. In your src, create a folder called <strong>github.com</strong>, in it have your github username as a folder where all your Go projects will be kept.</li><li>Before you start the API we are about to build, you should be in this directory $ GOPATH/src/github.com/&lt;Github username&gt;. This should now be your current working directory.</li></ul><h3>Getting started</h3><p>We create a new folder called go-rest-api and change directory into it.</p><pre>$ mkdir go-rest-api</pre><pre>$ cd go-rest-api</pre><p>We then create an entry point which is the main.go file.</p><pre>$ touch main.go</pre><p>Open the <strong>main.go</strong> file in your favourite text editor and let&#39;s get moving.</p><p>Next, we define our package main and test out the app using the main function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/858b7eb5eff19779cecad6770bb4a521/href">https://medium.com/media/858b7eb5eff19779cecad6770bb4a521/href</a></iframe><p>Let’s test it out.</p><p><strong>Note: </strong>This is how we will be building and running our API</p><pre>$ go build</pre><pre>$ ./go-rest-api</pre><p>Expected results:</p><pre>$ Hello World</pre><p>Let’s get to understand what we just did:-</p><p>Packages are re-usable pieces of code that are used as shared libraries.<strong> </strong>The <strong>package “main” </strong>is used when we are developing executable programs. It tells the Go compiler that the package should compile as an executable program instead of a shared library.</p><p><strong>func main</strong> is just a function name but when used with package main, it serves as the application entry point.</p><p><a href="https://godoc.org/golang.org/x/exp/errors/fmt">fmt</a> is a golang package that implements formatted I/O.</p><h3>Set up the HTTP server using Gorilla Mux</h3><p><a href="https://github.com/gorilla/mux">Gorilla Mux</a> is a package that implements a request router and dispatcher for matching incoming requests to their respective handler.</p><p>Let’s install it (Remember that you should do it while still in your GOPATH):-</p><pre>$ go get -u <a href="https://github.com/gorilla/mux">github.com/gorilla/mux</a></pre><p>We then use Gorilla Mux to help us make our first home endpoint “<strong>/</strong>”.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0247cb710143001648211d05c48cecab/href">https://medium.com/media/0247cb710143001648211d05c48cecab/href</a></iframe><p>In this case, we have created a function that will return the “<strong>Welcome home!</strong>” string. This is when the <strong>“/”</strong> endpoint is hit.</p><p>We also created a server that runs on <a href="http://localhost:8080/">h</a>ttp://localhost:8080</p><p>Expected results in <a href="https://www.getpostman.com/">Postman</a>:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67mgXTyKW0cjH3Y5w3BobQ.png" /></figure><h3>Create a Dummy database</h3><p>Let’s create a struct and a slice inside the main.go file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4d4afd49efe9d706a150f2d1f42729a/href">https://medium.com/media/b4d4afd49efe9d706a150f2d1f42729a/href</a></iframe><p>We will only use the Title and Description fields for our event struct. The slice(dummy database) contains event structs and from the slice, we will be able to append a new event struct, read it, update it and also delete it.</p><h3>Create an event</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8e9a345f01ab8bda07de601f7c28567/href">https://medium.com/media/c8e9a345f01ab8bda07de601f7c28567/href</a></iframe><p>When creating an event, we get data from the user’s end. The user enters data which is in the form of http Request data. The request data is not is a human-readable format hence we use the package ioutil to convert it into a slice.</p><p>Once it is converted to a slice, we unmarshal it to fit into our event struct. Once it is successful, we append the new event struct to the events slice and also display the new event as an http Responsewith <strong>201 Created Status Code.</strong></p><p>Expected results in <a href="https://www.getpostman.com/">Postman</a>:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OY7gglL3gCDO37_26hvZmw.png" /></figure><h3>Get one event</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dba64a1a56f159484ff4eb551b7e6b3/href">https://medium.com/media/1dba64a1a56f159484ff4eb551b7e6b3/href</a></iframe><p>The endpoint for getting one event is /events/{id} and uses a GET Method. Using Gorilla mux, we get the value of the <strong>“id” </strong>and use it to filter out a specific event from the events slice. When the “id” resembles the one of an event in the slice, we get its value and display it as a response to the user.</p><p>Expected results in <a href="https://www.getpostman.com/">Postman</a>:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dEPpdUocY16FwcJJ6FWB8Q.png" /></figure><h3>Get all events</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e906925a10fee4fc57862193dec1e83/href">https://medium.com/media/4e906925a10fee4fc57862193dec1e83/href</a></iframe><p>To get all the events, we simply display the whole events slice.</p><p>Expected results in <a href="https://www.getpostman.com/">Postman</a>:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHS3VRlgJLCPJ4vyAU6sRQ.png" /></figure><h3>Update an event</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d7751e17dfb5ef6f3bf7a6a08a89fa6/href">https://medium.com/media/3d7751e17dfb5ef6f3bf7a6a08a89fa6/href</a></iframe><p>The endpoint for updating an event is /events/{id} and uses a PATCH Method. Using Gorilla mux, we get the value of the <strong>“id” </strong>and use it to filter out a specific event from the events slice. When the “id” resembles the one of an event in the slice, we get to alter the values of the Title and Description fields in the event struct.</p><p>After that, we update the value of the struct in the events slice. We finally return the value of the updated event struct as a response to the user.</p><p>Expected results in <a href="https://www.getpostman.com/">Postman</a>:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rEFPP-iGBd9Qa7UT0bI96g.png" /></figure><h3>Delete an event</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/304d4c3fa9fed9d34aa1b35714a24283/href">https://medium.com/media/304d4c3fa9fed9d34aa1b35714a24283/href</a></iframe><p>The endpoint for deleting an event is /events/{id} and uses a DELETE Method. Using Gorilla mux, we get the value of the <strong>“id” </strong>and use it to filter out a specific event from the events slice. When the “id” resembles the one of an event in the slice, we remove the event in the slice and return a successful deletion message to the user.</p><p>Expected results in <a href="https://www.getpostman.com/">Postman</a>:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ZLIA3pysT2ebuWCOs2L5Q.png" /></figure><h3>Prepare all routes</h3><p>Let’s now combine all our routes…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55b97c925f31c83428e2a1dd36eb41f5/href">https://medium.com/media/55b97c925f31c83428e2a1dd36eb41f5/href</a></iframe><h3>Finally</h3><p>Here is the full main.go file. Test it all out and happy coding!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dec36d95dabccced47710cac47d786c1/href">https://medium.com/media/dec36d95dabccced47710cac47d786c1/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85a83420c9da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-andela-way/build-a-restful-json-api-with-golang-85a83420c9da">Build a RESTful JSON API with GOlang</a> was originally published in <a href="https://medium.com/the-andela-way">The Andela Way</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My people, my motivation]]></title>
            <link>https://medium.com/@ianduncan08/my-people-my-motivation-71803023749e?source=rss-6ae6d826295c------2</link>
            <guid isPermaLink="false">https://medium.com/p/71803023749e</guid>
            <category><![CDATA[commitment]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[andela]]></category>
            <dc:creator><![CDATA[Ian Duncan]]></dc:creator>
            <pubDate>Wed, 02 May 2018 12:51:30 GMT</pubDate>
            <atom:updated>2018-05-02T12:51:30.642Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s week two, day two. What keeps me going? It’s simple, motivation and my commitment to doing the challenges that we have had. All this comes from the amazing people around me. The LFAs, wow, epic problem solvers in human form. All my fellows that proceeded to this week have also made a great impact in my life. Each individual here at Andela has a story behind their success and from that, I get the zeal to move on.</p><p>They say, “Never give up”. Others say, “Never stop trying”. One of my fellows, Lenny Kioko, is one guy that I have come to realize that he is one of the reasons why am here. His several Andela applications shocked me but it also taught me. Week one was up and running, Flask was still new and looked more complicated. I displayed the face of being green every time I heard people talk about it. Lenny gave me the motivation to keep learning as I would ask a question concerning a blocker that I had and it always had that solution. I hated debugging my code but realized the happiness of knowing how to go about it.</p><p>Week two day one, my week one LFA, John Ndero, gave us a talk about his life in relation to the application. The guy was so green and actually learned much about the coding work while on boot camp. From a finance background to a totally different world of programming and still making it, why would I give up? I actually knew that someone as green as I am made it, so it’s a challenge that I have to take and give my all.</p><p>Week one day four, deadline is due and few of my endpoints are working. Panic wrote all over my face. I had the feeling of giving up and never try something to do with Andela. I thought I was alone until I got a slack message from one fellow, Didi. It was all about trying and never giving up. She said, “It is better to try and fail rather than to give up due to the fear of the unknown.” I immediately went back to the code and made three endpoints to work. How happy was I about it. I submitted it on time and made more research afterward.</p><p>“No question is a stupid question. However simple it may be.” This is a very important sentiment from the LF, Ann Mukundi. The fear of asking questions slowly vanished and I got to blend in with everyone. I nowadays never sit with a blocker for long. “Never sit with a blocker for more than thirty minutes,” says Sagini, my week two LFA. So far, there is the freedom of enquiring for more as the answers never end. Solutions are the as the people helping you have also experienced it before.</p><p>“If you can dream it, you can do it,” week two day two motivation came in handy. I have had a dream of being a world-class developer. I bet that Andela is what will connect my dream and I. I never stop dreaming and it means I will never stop trying. Commitment is something that I came to notice when being among my fellow, we give each other motivation to our effort. No one knows your tomorrow but your commitment and motivation from others define your tomorrow. You Own Your Own You(YOYO), so never give up as success is in your hands. TIA, my dream, my home!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71803023749e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Team, My Pride. Together as Wassabi!]]></title>
            <link>https://medium.com/@ianduncan08/my-team-my-pride-together-as-wassabi-203bcad94f2a?source=rss-6ae6d826295c------2</link>
            <guid isPermaLink="false">https://medium.com/p/203bcad94f2a</guid>
            <category><![CDATA[andela]]></category>
            <category><![CDATA[wassabi]]></category>
            <category><![CDATA[relationship-building]]></category>
            <dc:creator><![CDATA[Ian Duncan]]></dc:creator>
            <pubDate>Wed, 25 Apr 2018 09:44:07 GMT</pubDate>
            <atom:updated>2018-04-25T10:41:52.665Z</atom:updated>
            <content:encoded><![CDATA[<p>John Waithaka. “Who is this guy?” I asked myself when we were put in groups on the 23rd. He is just a normal person but in an amazing way. When I was told stories about the previous cohorts, I knew LFAs were very fierce and I tell you this being my first time, I was ready to face his wrath. Upon sitting next to him, I first froze but had that fake smile to show that am “OK”. Then came the introduction part. I had planned in mind to be so formal but then my fellow teammates were just relaxed. So I had to blend in and from that time, I never had the fear anymore but the urge to go ahead with a new mentality.</p><p>John sat next to me. I admired the Mac Book on his seat. The way he handled just showed me that indeed there is much to do for one to get to have the Mac at hand. It still looked new yet he joined last year(2017) in cohort XX(20). I bet he knows how to take care of his items well. John turned out to be the most friendly person around me and I found myself letting out all the questions I had. Too bad for my question, they all got an answer! I came to learn new ways of doing my work. He taught me good ways of writing stories to my pivotal tracker. I am really a developed guy right now. Much thanks to this guy, John.</p><p>Didi Kashemwa. “One interesting thing about me is that I love animals, especially cats.” This is the first statement that made me recognize her. She seemed so passionate about what she does, that is even in technology. I first came to know about her from slack then met her during the Open Saturday forum. Android was her area of control and she has been there for quite some time. She then got a job and was a full-time blogger until something bad happened. She just got fired for being five minutes late. Pretty sad though. But she inspires me by the hard work she does.</p><p>“Never give up”. I think this is what drives her as she constantly applies for Andela without giving up. When she sat next to me, I realized that I can also become a talkative person. I really opened up and shared my experience from the time I started programming. She knew a lot about Flask and Test Driven Development. I felt good when after the end of the session(Day One), we remained behind and I was guided through TDD. We even went back to the Andela Campus where we stayed there till late just sharing more on the code. She is a great personality.</p><p>Saem Ndisho. All this time since the Open Saturday, I knew him as Sam. Then came the shocker, it’s Saem instead. Weird, right? Apparently, this guy has been a DJ for some time but he later came to realize that programming is more interesting. I guess this is where passion comes in. He liked experimenting with codes and has a vast knowledge of docker. He is actually a programmer in his own startup and does much to make ends meet.</p><p>Saem recently decided to change his operating system to a Linux based os(Probably Kali Linux). This was after he had tried Ubuntu but it didn’t give him the nice feeling he expected. Right now he enjoys using it. We had some chats way back and he made me realize that it’s not a must for you to be a genius for you to learn code.</p><p>Barkley Koin. This name has two relatable meanings. The first name is a sort of a bank, and the second one is a coin. This guy must be money or something close to that. Koin is an ALC(Andela Learning Community) ambassador at Dedan Kimathi University. He is very open to the people around. I was very happy when he created a hotspot and invited me to use it so that we all could submit our work. This in itself is already a true sign of collaboration.</p><p>Koin seems to have programmed for some time and planning his work really mesmerized me. He taught me how to write Pivotal Tracker stories in a very nice way using GIVEN/WHEN/THAT convention. He is graduating this Friday. I wish him well.</p><p>In all this short period, I have learned that YOYO is the way to go. When you are in control, you will define yourself well and others too will know who you are. And you are what makes the team. Together as Wassabi!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=203bcad94f2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Want to be a programmer? It’s all in the mind]]></title>
            <link>https://medium.com/@ianduncan08/want-to-be-a-programmer-its-all-in-the-mind-cba598d38cf5?source=rss-6ae6d826295c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cba598d38cf5</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[andela]]></category>
            <category><![CDATA[bootcamp]]></category>
            <dc:creator><![CDATA[Ian Duncan]]></dc:creator>
            <pubDate>Mon, 23 Apr 2018 12:57:41 GMT</pubDate>
            <atom:updated>2018-04-23T12:57:41.179Z</atom:updated>
            <content:encoded><![CDATA[<p>High school is over. Yeah! My 2016 ended on a good note. Knowing that I have nothing to lose. I had realized that there is so much to do in terms of my passion in joining the tech industry. So I immediately signed up for cohort IV(15) which was in January. This is the time I realized that I was not ready. I borrowed a laptop and tried going through the home study. Oh my God! Everything seemed so new. I panicked and had that mentality of not being able to learn the new stuff as they were so deep, that’s according to me at that time. I convinced myself that I am too young to join the industry. So I gave up and waited for the deadline to bypass me. I had accomplished sixty percent of the questions on Proctor. Since that time, I had the mindset that I cannot make it and things were tough in the future.</p><p>Nine months down the line, I was still that boy who disliked the programming and then got enrolled to study computer science at Multimedia University. In class, we were being taught the basic concepts of programming and we used C language in our practice. All was not going well for me and had the idea of dropping out. When the semester got finished, I was so excited that I would be free at last. I knew life without programming was good. My mind was really fixed and I knew no one would convince me otherwise.</p><p>“Do miracles really happen?”, I asked myself this question. A friend of mine, a second year, came to visit me in school. He was so much into programming and I wondered how he did it. We sat down and spent half the day talking about how my past has been. He got to understand my situation and advises started to flow in. I felt like the world was telling me to try out new things instead of just sitting down and waiting for my parents to do helping part. Funny enough, they knew I was hardworking but I myself was the laziest.</p><p>The next day came and I deleted all my favorite series and movies. There I was, a totally different person. I guess my mindset was now changed. I was no longer fixed. I managed to write my first “Hello World” and reflected on the Andela home study materials that were sent to me earlier in cohort IV. So after that, the same friend came and shared stories about Andela. I listened and made my research appropriately. I knew there was something about this place Andela. In a short while, I was there applying for cohort XXVII.</p><p>The questions for the home study tests came in. I went through it once again to a point where I could answer the questions without having to get a reference material. I felt motivated, the thing I had made up my mind not to do, I am now the one doing them well. Python became a favorite language as I played around with the data structures. Once I received my qualified codility tests, I did it with minimal errors that I solved by myself. Wow! Life gave me a chance once again.</p><p>Upon receiving the Bootcamp invitation, I checked and knew there was so much to learn and dedicated my all to it. I left home to go and stay in school despite the ongoing strike. I had plenty of time for my studies and in a span of one week, I was able to know my Python classes really well and also tried Test Driven Development. Git became my best friend and now I could keep track of my activities. Persistence and the urge to learn made me go far. I now can make something using HTML, CSS, JS, and Python.</p><p>The mind. How it can turn things is incredible. It’s all in the mind. You just need to free yourself and you will find yourself. I nowadays can’t let an error go without solving it. I am happy that I am here for week one at Andela. Will be persistent as I maintain all the required targets. Live, love and learn throughout your life. YOYO!(You own your own)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cba598d38cf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>