<?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 Noah Kreiger on Medium]]></title>
        <description><![CDATA[Stories by Noah Kreiger on Medium]]></description>
        <link>https://medium.com/@noahkreiger?source=rss-870e515b937------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MCYu2rWnS-cRYpCDri0lNw.png</url>
            <title>Stories by Noah Kreiger on Medium</title>
            <link>https://medium.com/@noahkreiger?source=rss-870e515b937------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 22:41:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@noahkreiger/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[Golang: Building Dynamic URLs]]></title>
            <link>https://noahkreiger.medium.com/golang-building-dynamic-urls-4e93cab86e72?source=rss-870e515b937------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e93cab86e72</guid>
            <category><![CDATA[url]]></category>
            <category><![CDATA[golang-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Noah Kreiger]]></dc:creator>
            <pubDate>Thu, 24 Jun 2021 01:17:25 GMT</pubDate>
            <atom:updated>2021-06-24T01:20:32.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ifpd_HtDiK9u6h68SZgNuA.png" /><figcaption><a href="https://undo.io/assets/thumbnail/600/840/890/webp/None/80/">https://undo.io/assets/thumbnail/600/840/890/webp/None/80/</a></figcaption></figure><p>You see a lot of stories on medium about how to do complex tasks or architect a production-level project. What you don’t see enough is how to do something as simple as building URLs with Golang, a task almost every micro-service does, however, nobody has a good way to do it…</p><p>In this tutorial, we will walk through how to build URLs cleanly, config-driven, and best of all, testable :). Let’s write some code.</p><p>First, we are going to define our struct, the struct will be our basis for building config-driven URLs. Almost every REST URL is made up of static (host, schema, etc) and dynamic parts (query and route parameters). The struct will host all of our static parts derived from the application configuration.</p><p>We will give the struct default values, but in a real-world application, I would recommend populating the struct through a config file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94442d7f50ed3c5c4de449d46a2546b4/href">https://medium.com/media/94442d7f50ed3c5c4de449d46a2546b4/href</a></iframe><p>From the example above you can see I am simulating a connection to the free, external REST API api.weatherapi.com.</p><p>Second, let’s define our first dynamic endpoint and than break it down piece by piece to make sure we truly understand it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57a265ad1f50ee716ef9e0f1596c0f8f/href">https://medium.com/media/57a265ad1f50ee716ef9e0f1596c0f8f/href</a></iframe><p>At the top, we have our Formatter return type, which is basically just defining what our method receiver will return. A string for the HTTP method, and the Golang built-in type url.URL as the second.</p><p>Next, we are creating our base url.URL object with the values held in the struct, since this is a go method receiver. These should be the config-driven static values that you add to that specific URL.</p><p>Below the static values, we are adding the dynamic query parameters to the URL, which we encode and assign.</p><p>Let’s take a look at our main.go integration with our new URL building receiver.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ca7129ab40744a43557d2b2aa7dd0cf/href">https://medium.com/media/6ca7129ab40744a43557d2b2aa7dd0cf/href</a></iframe><pre>go run main.go<br>2021/06/22 22:36:51 GET<br>2021/06/22 22:36:51 <a href="https://api.weatherapi.com/forecast.json?dateKey=testDate&amp;regionKey=testRegion">https://api.weatherapi.com/forecast.json?dateKey=testDate&amp;regionKey=testRegion</a></pre><p>Wrapping the URL building functions in a struct allows you to easily combine static and dynamic values, with granular control over each route but the flexibility to handle any variation. Moreover, this strategy allows you to mock and test entire groups of routes at a time, that can be copied and pasted across micro-services. The functional response can easily become a parameter in other methods to attain the desired information, and you only have to update it in one place if you decide to make changes.</p><p>While this seems like a trivial part of the application, as you begin to add more and more APIs, the route building to connect them all can quickly get out of control. It is consistent strategies like these across your application that allow you to remain bug-free…and sane.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e93cab86e72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quasar Atomic Design Framework]]></title>
            <link>https://noahkreiger.medium.com/quasar-atomic-design-framework-f595ddd72428?source=rss-870e515b937------2</link>
            <guid isPermaLink="false">https://medium.com/p/f595ddd72428</guid>
            <category><![CDATA[quasarframework]]></category>
            <category><![CDATA[quasar]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Noah Kreiger]]></dc:creator>
            <pubDate>Fri, 19 Feb 2021 04:35:28 GMT</pubDate>
            <atom:updated>2021-02-19T04:35:28.323Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*U-EpAsQdCSyys1A8Pl-w3A.png" /></figure><p>Finding a production-level architecture for web development is a challenge. It seems that each company, consulting firm, individual, etc…create their own.</p><p>Atomic Design can be used to standardize web development frameworks with a production-ready, scalable design.</p><p>I won’t go into detail explaining it, because <a href="https://medium.com/@WeAreMobile1st/atomic-design-getting-started-916bc81bad0e">this article</a> does a great job.</p><p>Here is an atomic design starting point for one of my favorite VueJS frameworks.</p><p><a href="https://github.com/nkreiger/quasar-atomic-design-template">quasar atomic design starting framework</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f595ddd72428" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with GoLang and MongoDB]]></title>
            <link>https://noahkreiger.medium.com/simple-golang-api-with-mongodb-4531e4c877b4?source=rss-870e515b937------2</link>
            <guid isPermaLink="false">https://medium.com/p/4531e4c877b4</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Noah Kreiger]]></dc:creator>
            <pubDate>Tue, 29 Dec 2020 18:14:47 GMT</pubDate>
            <atom:updated>2020-12-31T15:01:39.912Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Started with Golang and MongoDB</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KidtkCnHaNI4jIjHH_h41w.png" /></figure><p>In this tutorial we will set-up a local GoLang API development environment for <a href="https://www.mongodb.com/">MongoDB</a> with the <a href="https://github.com/mongo-express/mongo-express">Mongo Express</a> GUI.</p><p>Let’s get started!</p><p>We cannot connect to Mongo unless we have an instance of MongoDB actually running. There are multiple ways to accomplish this, but the simplest for local development is to spin up a docker container running mongo.</p><p>For this, we will use docker-compose to spin up the instance and the GUI on top of it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/05ffe3ebda74c89e4665b030e24638d7/href">https://medium.com/media/05ffe3ebda74c89e4665b030e24638d7/href</a></iframe><pre>docker-compose -f mongo-compose.yaml up -d</pre><p>After the services are up you should be able to navigate to <a href="http://0.0.0.0:8081/">http://0.0.0.0:8081/</a> and see your Mongo Express GUI overlaying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5uSF2zp3KxC7UzeWUdQwog.png" /><figcaption>Mongo Express GUI</figcaption></figure><p>Now that we have confirmed our local instance of Mongo and the GUI is running, we can create our API. It will have one simple handler that confirms the connection to the database.</p><p>I prefer to serve my API’s gracefully, a great tutorial is located <a href="https://medium.com/honestbee-tw-engineer/gracefully-shutdown-in-go-http-server-5f5e6b83da5a">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0241a0bfd796026b071dd706a0a90fe9/href">https://medium.com/media/0241a0bfd796026b071dd706a0a90fe9/href</a></iframe><p>We’ve routed all traffic from ${host}/health to the services.Health handler.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3e19e1cf35c05a25fa052d0ab78d860/href">https://medium.com/media/d3e19e1cf35c05a25fa052d0ab78d860/href</a></iframe><p>This is a very simple handler that calls the mongo.Connect function and returns the appropriate http status based on the response.</p><ul><li>*Important to note the client.Disconnect function that ensures we are ALWAYS clearing our MongoDB connections because their is a <strong>finite </strong>amount of connections allowed to a mongo instance</li></ul><p>The last piece of the puzzle is to create the actual mongo client function that will both to connect to mongo and send a <strong>ping </strong>to verify the connection.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b10960bfdaa1826bbca126f8a4327475/href">https://medium.com/media/b10960bfdaa1826bbca126f8a4327475/href</a></iframe><p>We can now test our API with a simple</p><pre>go run main.go</pre><pre>GET http://localhost:8080/health</pre><p>If you stop the docker container running Mongo it should return a 400, and if you start it again, you should receive the appropriate 200.</p><p><a href="https://github.com/nkreiger/gomongo_simple_api">nkreiger/gomongo_simple_api</a></p><p>Thanks for the Read! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4531e4c877b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NodeJS + Redis: Setting it Up Asynchronously]]></title>
            <link>https://noahkreiger.medium.com/nodejs-redis-setting-it-up-asynchronously-ba8db73e07de?source=rss-870e515b937------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba8db73e07de</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[redis-cluster]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[asynchronous]]></category>
            <dc:creator><![CDATA[Noah Kreiger]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 03:03:49 GMT</pubDate>
            <atom:updated>2020-06-04T03:05:37.649Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNVtmc5MPSW8Ro681984aw.png" /><figcaption><a href="https://www.skcript.com/svr/how-to-do-job-scheduling-with-redis-and-node-js/">image source</a></figcaption></figure><p>Recently, I began working on a project involving <a href="https://redis.io/">Redis</a>, a very powerful and simple in-memory data structure store. In this article, I will discuss how I went about setting it up asynchronously.</p><p>Let’s get started! :)</p><p>First, follow these commands to gather the packages necessary to set-up a NodeJS + <a href="https://expressjs.com/">ExpressJS</a> API with Redis.</p><pre>npm init</pre><pre>npm install --save redis express body-parser</pre><p>We will be using the <a href="https://www.npmjs.com/package/redis">node-redis</a> package for our integration with the Redis server due to its simplicity, reliability, and documentation.</p><p>Next, let’s set-up the Redis server. For this I will use a standard practice, running the server in a docker container locally.</p><p><a href="https://hub.docker.com/_/redis">Official Image</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/383f5875fda429326d7d59c054bd812c/href">https://medium.com/media/383f5875fda429326d7d59c054bd812c/href</a></iframe><p>Run the following command in the project root directory where your docker-compose file should be located</p><pre>docker-compose up -d</pre><p>To ensure it is running:</p><pre>docker ps</pre><p>Now that our Redis server is running and we have the necessary packages, let’s start coding our API!</p><p>First, we set up our server with a few basic endpoints that <strong>will</strong> read and write from Redis.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4e5495d970724e823d91a592faebc3e/href">https://medium.com/media/f4e5495d970724e823d91a592faebc3e/href</a></iframe><p>The <strong>GET</strong> endpoint will take in a router param key to retrieve from Redis</p><pre>GET <a href="http://localhost:3000/hello">http://localhost:3000/hello</a></pre><p>The <strong>POST </strong>endpoint will store a JSON KV pair in Redis</p><pre>POST <a href="http://localhost:3000/send">http://localhost:3000/send</a><br>{<br> &quot;key&quot;: &quot;hello&quot;,<br> &quot;value&quot;: &quot;John Doe&quot;<br>}</pre><p>Now that our endpoints are set-up, let’s hook up our Redis store. Assuming that I am hooking up my Redis store for a large application, I have decided that the functions should be universally defined in a store.js file where any part of my application that needs Redis may import and use them.</p><p>Let’s take a look at what that store.js file may look like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a2fe02ad8d7e38b5df1b02b176a0551/href">https://medium.com/media/3a2fe02ad8d7e38b5df1b02b176a0551/href</a></iframe><p>Per the node-redis documentation:<br>“<em>Node Redis currently doesn’t natively support promises (this is coming in v4), however you can wrap the methods you want to use with promises using the built-in Node.js </em><em>util.promisify method on Node.js &gt;= v8;</em>”</p><p>Since I’ve wrapped my methods in promisify I may now import them and use them asynchronously, increasing readability and following best practice.</p><p>Let’s take a look at what that would look like when integrated into our server.js endpoints.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fd9a0acadb035063e6c71dec8f55b9e/href">https://medium.com/media/1fd9a0acadb035063e6c71dec8f55b9e/href</a></iframe><p>I’ve imported the Redis async functions created in store.js (<strong>get</strong> and <strong>set</strong>) and utilized them in my API calls. Hopefully, from this example, you see how easy it is to set up Redis and import its powerful functionality directly into your API.</p><p>Before I stop droning on and on…I have one more example to show if you are looking for finer control over your Redis store and even further decoupling.</p><p>Let’s look at how we can replicate promisify by instituting our own promises into a Redis function. We will replace the <strong>getList</strong> promisify function in store.js with our own JS Promise variation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5cfd7ef4eaa3b69238917d7d97b1672/href">https://medium.com/media/e5cfd7ef4eaa3b69238917d7d97b1672/href</a></iframe><p>Adding Redis asynchronous support this way, rather than promisify as documented in the Redis npm package, allows for much finer control over the function. Before data is read into the Redis store we can provide custom validation, custom error handling, logging…etc, all decoupled from our application. Furthermore, we can set default values such as <strong>0</strong> and <strong>-1 </strong>as seen above that will carry over.</p><p>With Promisify:</p><pre>getList(&quot;frameworks&quot;, 0, -1)</pre><p>Custom Promises:</p><pre>getList(&quot;frameworks&quot;)</pre><p>I hope this helps you set up your next or existing project better with Redis! :)</p><p><a href="https://github.com/nkreiger/vueteer/blob/master/src/server/store.js">Example Github Repo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba8db73e07de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VueJS + PaperJS: A Canvas Story]]></title>
            <link>https://noahkreiger.medium.com/vuejs-paperjs-a-canvas-story-c412dc161b1f?source=rss-870e515b937------2</link>
            <guid isPermaLink="false">https://medium.com/p/c412dc161b1f</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[paperjs]]></category>
            <category><![CDATA[html5-canvas]]></category>
            <dc:creator><![CDATA[Noah Kreiger]]></dc:creator>
            <pubDate>Sat, 11 Apr 2020 14:35:41 GMT</pubDate>
            <atom:updated>2020-04-11T14:44:04.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qB7UFoFjJ4hT3WtgzEIXyA.png" /></figure><p><a href="https://vuejs.org/"><strong>VueJS</strong></a> is a powerful, progressive web framework.</p><p><a href="http://paperjs.org/about/"><strong>PaperJS</strong></a> is the swiss army knife for any web developers&#39; HTML5 canvases.</p><p>Let’s explore how to create a simple, clean VueJS web app that can leverage multiple drawing canvases through PaperJS. Enjoy :).</p><p>First things first, let’s install the VueJS CLI to create our app.</p><pre>npm install -g @vue/cli</pre><pre>mkdir vue</pre><pre>cd vue</pre><pre>vue create vue-canvas</pre><p>This will create a boilerplate app generated by Vue’s CLI. It may take a bit, choose all defaults. Now, let’s kick off our UI for the first time.</p><pre>cd vue-canvas</pre><pre>npm run serve</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ALG2fhx_B4wepLuTI9jwXA.png" /></figure><p>If you’re not familiar with VueJS, I recommend reading the getting started documentation on the website (Link is at the top of the article). I will use many of the concepts, but not dive deeply into any explanation of the infrastructure of VueJS.</p><p>Since I’m not a big fan of writing CSS code, for this tutorial I am going to be using Bootstrap in my project, for a <strong>1-minute install</strong> tutorial I suggest you follow this link: <a href="https://travishorn.com/adding-bootstrap-to-a-vue-cli-project-98c2a30e0ed0"><strong>bootstrap set-up</strong></a><strong>.</strong></p><p>To set-up a clean directory structure, remove the HelloWorld.vue component generated by Vue and create a new directory called pages. Create two new components: pages =&gt; Master.vue and components =&gt; Canvas.vue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RNWxMLCFIEApBbVEQRlAA.png" /></figure><p>Now, Let’s code.</p><p>The App.vue file will simply import our master component that will wrap the canvas and provide some <a href="https://getbootstrap.com/docs/4.4/layout/overview/">base styling</a> for our application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6a77effc5cc5bafa6245807007fe882/href">https://medium.com/media/d6a77effc5cc5bafa6245807007fe882/href</a></iframe><p>The Master.vue file will wrap the canvas component to provide a layout. We will also create a clear button to reset our canvas, but all the logic for that will be stored in the child component. To reference that function from the parent we can easily do that using <a href="https://vuejs.org/v2/guide/components-edge-cases.html">VueJS refs</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5108ef29258f01f462cf65b74c5142c8/href">https://medium.com/media/5108ef29258f01f462cf65b74c5142c8/href</a></iframe><p>Lastly, we will create our Canvas.vue component that will be a single, draw-able canvas, that extends the functionality from PaperJS.</p><pre>npm install --save paper</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf453fcab099f71333354b31361394f0/href">https://medium.com/media/bf453fcab099f71333354b31361394f0/href</a></iframe><p>Attaching our PaperJS scope to the canvas:</p><pre>this.scope.setup(this.canvasId);</pre><p>Creating our path:</p><pre><em>return new </em>paper.Path({<br>    strokeColor: &quot;#000000&quot;,<br>    strokeJoin: &#39;round&#39;,<br>    strokeWidth: 1.5<br>})</pre><p>Creating our tool:</p><pre><em>return new </em>paper.Tool();</pre><p>On mouse down, we are using the <a href="http://paperjs.org/reference/tool/">PaperJS Tool</a> to draw, and it knows where and what to draw because we have attached our path and setup our canvas scope.</p><p>PaperJS is a powerful JS package we can use to extend the functionality of our web applications. Enjoy! :). <a href="https://github.com/nkreiger/vue-canvas">Github Repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c412dc161b1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>