<?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 Cam Bass on Medium]]></title>
        <description><![CDATA[Stories by Cam Bass on Medium]]></description>
        <link>https://medium.com/@cambass?source=rss-47267e6bbaa1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*p6l45rDXe7Jv-1HGFB0_Jg.jpeg</url>
            <title>Stories by Cam Bass on Medium</title>
            <link>https://medium.com/@cambass?source=rss-47267e6bbaa1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:01:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cambass/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[3 Reasons To Learn Vim]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://cambass.medium.com/3-reasons-to-learn-vim-9accbb21c000?source=rss-47267e6bbaa1------2"><img src="https://cdn-images-1.medium.com/max/2278/1*KWP5kCfuJZn6D6raZFANmg.png" width="2278"></a></p><p class="medium-feed-snippet">Learning Vim is challenging but well worth your time</p><p class="medium-feed-link"><a href="https://cambass.medium.com/3-reasons-to-learn-vim-9accbb21c000?source=rss-47267e6bbaa1------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://cambass.medium.com/3-reasons-to-learn-vim-9accbb21c000?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9accbb21c000</guid>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Sun, 15 Jan 2023 03:29:06 GMT</pubDate>
            <atom:updated>2023-01-15T05:24:30.668Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building A Custom Input For OTP Codes]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://javascript.plainenglish.io/building-a-custom-input-for-otp-codes-bd79d45f5e?source=rss-47267e6bbaa1------2"><img src="https://cdn-images-1.medium.com/max/614/1*U-EGAHmCRce9A6namfAbnQ.png" width="614"></a></p><p class="medium-feed-snippet">Step-by-step guide for building a smooth number input</p><p class="medium-feed-link"><a href="https://javascript.plainenglish.io/building-a-custom-input-for-otp-codes-bd79d45f5e?source=rss-47267e6bbaa1------2">Continue reading on JavaScript in Plain English »</a></p></div>]]></description>
            <link>https://javascript.plainenglish.io/building-a-custom-input-for-otp-codes-bd79d45f5e?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd79d45f5e</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Mon, 09 Jan 2023 21:47:23 GMT</pubDate>
            <atom:updated>2023-01-09T21:47:23.728Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How To Build A NPM Package]]></title>
            <link>https://levelup.gitconnected.com/how-to-build-an-npm-package-4158347e7fbf?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4158347e7fbf</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 23:21:58 GMT</pubDate>
            <atom:updated>2022-12-21T12:10:07.892Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lessons learned from creating my first Javascript package</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*3dflltxefAAYTYQVxIj5FQ.png" /></figure><p>As developers, we are always trying to figure out how to make our solutions extensible and reusable. We hate rewriting the same code over and over again. Walking the line between maximum production and automation takes a lot of work. At times, it becomes clear that a solution can be abstracted outside of the current project and pulled directly in from a third party. I want to share a recent solution that made perfect sense to create an NPM package and use that solution directly in our application. To this point, I had never created an NPM package, so I hope it will be helpful to share my experience in this post.</p><h4><strong>Why Build an NPM Package?</strong></h4><p>We could write solutions directly in the apps we build, which will suffice. But great solutions reduce duplication and follow the code patterns necessary to achieve <a href="https://www.digitalocean.com/community/tutorials/what-is-dry-development">DRY</a> code.</p><p>As “<a href="https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/">The Pragmatic Programmer</a>” states:</p><blockquote>Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.</blockquote><p>Sometimes we can create a definitive solution outside our application and pull the module inside our app to achieve an end. This is an excellent exercise for the developer and gives back to the programming community, as your solution will likely solve someone else’s problem. Writing a solution that can be used anywhere forces the developer to problem-solve unambiguously; that alone is a selling point for me. I’m not arguing that every solution should be turned into a package, but we should be equipped with the tools and know-how when needed.</p><p>I won’t cover all the nitty-gritty in this tutorial, but I thought it would be helpful to give a high-level overview of the necessary steps to creating and using your first NPM package.</p><h3>How to Build an NPM Package?</h3><p><strong><em>These are the steps I followed to create my first NPM Package.</em></strong></p><h3>Step 1: Register with NPM</h3><p>This step is necessary for publishing your package when it’s ready. I could walk you through this portion, but NPM already has excellent documentation for flow:</p><p><a href="https://docs.npmjs.com/getting-started">Getting started | npm Docs</a></p><p>Once that is complete, we can move on to the fun part.</p><h3>Step 2: Have a problem to solve or an idea</h3><p>The application I work on has a two-factor login flow. The last step in the login flow was providing the user with input for the One-Time Password. The first iteration used a number input stylized to look as good as possible. Still, our designer wanted an input that presented each number with its input broken into six separate inputs. Here are some images to make it more straightforward:</p><h4>Original Input</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*hD6Bh8v5oCVbLZj9kGOcyA.gif" /></figure><h4>Input Created by my NPM package</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*RX_8HYkK2xRKCY3hn7a8kA.gif" /></figure><p>It was challenging to build this input from scratch, but as I started the process, I quickly realized this solution made sense as a reusable module that should exist as an NPM package. This input requires quite a bit of Javascript to handle the edge cases and ensure the user is presented with a smooth experience as they make their input. Here is how I created <a href="https://github.com/cameronbass/honeycrisp">Honeycrisp</a>, my first NPM Package.</p><p><strong><em>Note: </em></strong><em>You can demo the package I created here -&gt; </em><a href="https://codepen.io/cambass23/pen/wvxwJKY"><em>Codepen</em></a></p><h3>Step 3: Create the “package.json” file</h3><p>The easiest way to create a package.json file is to run the npm init command from your project root:</p><pre>&gt; mkdir path-to-project/honeycrisp<br>&gt; cd path-to-project/honeycrisp<br>&gt; npm init </pre><p>npm init will guide you through options that will define your package.json file. Here is mine after running npm init:</p><pre>{<br>  &quot;name&quot;: &quot;honeycrisp&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;description&quot;: &quot;A crispy input&quot;,<br>  &quot;main&quot;: &quot;app.js&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;test&quot;<br>  },<br>  &quot;author&quot;: &quot;&quot;,<br>  &quot;license&quot;: &quot;ISC&quot;<br>}</pre><p>The point of interest here is the main field. As the NPM docs describe it:</p><blockquote>The “main” field is a module ID that is the primary entry point to your program. That is, if your package is named foo, and a user installs it, and then does require(&quot;foo&quot;), then your main module&#39;s exports object will be returned.</blockquote><p>The package.json file above is the most simplistic version of a package.json file needed. There are quite a few more fields that can be leveraged to define your project. It’s very helpful to consult the official docs here —</p><h4>Package.json Docs:</h4><p><a href="https://docs.npmjs.com/cli/v7/configuring-npm/package-json">package.json | npm Docs</a></p><h3>Step 4: Write your entry point file:</h3><p>I used the name app.js for my main file. For the simplicity of this tutorial, I kept all of my code in one file. It’s not essential to understand everything about this code. I just wanted to share this for demonstration purposes.</p><p><em>This is all the code necessary to create the input demonstrated above. This project is still actively being updated, as there are plenty of upgrades to be made. Feel free to consult the package on GitHub for the latest version: </em><a href="https://github.com/cameronbass/honeycrisp"><em>HONEYCRISP ON GITHUB</em></a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7bc3c6347f9fac3cb9de4010f32047bf/href">https://medium.com/media/7bc3c6347f9fac3cb9de4010f32047bf/href</a></iframe><p>After writing that file, I updated my version in the package.json file and tested my solution.</p><h3>Step 5: Test your package with NPM Pack</h3><p>NPM Pack is an excellent tool for testing your package without publishing it. NPM uses <a href="https://semver.org/">semantic versioning</a>, and instead of publishing a new version to NPM every time you want to test a change, you can create a TAR file, save it locally, and test that against the application you are applying it to.</p><p><strong><em>How to use </em></strong><strong><em>npm pack —</em></strong></p><p>First, update your package.json file to a new version. The version is arbitrary, but you should be logical about the flow. Mine looks like this now:</p><pre>{<br>  &quot;name&quot;: &quot;honeycrisp&quot;,<br>  &quot;version&quot;: &quot;1.0.1&quot;, // &lt;- update version<br>  &quot;description&quot;: &quot;A crispy input&quot;,<br>  &quot;main&quot;: &quot;app.js&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;test&quot;<br>  },<br>  &quot;author&quot;: &quot;&quot;,<br>  &quot;license&quot;: &quot;ISC&quot;<br>}</pre><p>Second, from the root of your project, run the NPM Pack command:</p><pre>&gt; npm pack<br><br>npm notice<br>npm notice 📦  honeycrisp@1.0.1<br>npm notice === Tarball Contents ===<br>npm notice 173B package.json<br>npm notice === Tarball Details ===<br>npm notice name:          honeycrisp<br>npm notice version:       1.0.1<br>npm notice filename:      test-1.0.1.tgz<br>npm notice package size:  204 B<br>npm notice unpacked size: 173 B<br>npm notice shasum:        2c069041cc1d121d0a0a0286b60fe86e80b5a<br>npm notice integrity:     sha512-X6RzbgcmgYeb/[...]gQoUMy2H3QyiA==<br>npm notice total files:   1<br>npm notice<br>test-1.0.0.tgz</pre><p>Third, copy the file to the root of your machine:</p><pre>cp honeycrisp-1.0.1.tgz</pre><p>Lastly, from the root of the application you are using it, install the local version of the package:</p><pre>&gt; cd path/to/application<br>&gt; npm install ~/honeycrisp-1.0.1.tgz</pre><p>Now you can test out your changes within the intended application. If something is not working correctly, make the changes to your package, bump the version and run npm pack again.</p><p>Here is some additional documentation for NPM Pack:</p><p><a href="https://docs.npmjs.com/cli/v7/commands/npm-pack">npm-pack | npm Docs</a></p><h3>Step 6: Publish your package</h3><p>After you are satisfied with the implementation of your package. Proceed to the most gratifying step in the process, publishing!</p><p>From the root of your project run:</p><pre>&gt; npm publish</pre><p>That command will create a TAR file, and NPM will automatically push it to a public registry. Your package can now be used by you and anyone else with access to NPM!</p><h3>Wrapping up —</h3><p>Hopefully, this served as a useful walkthrough for building your first NPM package. NPM has done a great job of taking the hard work off your plate and allowing you to focus on the technical details of your project.</p><h4>Additional considerations after you complete the first version of your package:</h4><ol><li>Make an excellent readme within your readme. Explain how to use the package and why a developer should use your package.</li><li>Our solutions will need to change over time. Define contributing guidelines so the community can help you improve your implementation.</li><li>Promote it!</li></ol><h4>Check out my first package Honeycrisp</h4><p>Here is a link to my NPM Package: <a href="https://github.com/cameronbass/honeycrisp">Honeycrisp</a></p><p>I plan to make plenty of updates as time goes on. As it stands right now, it’s very straightforward, so using it as an example for starting your project may work well. Of course, I would love feedback or contributions too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4158347e7fbf" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/how-to-build-an-npm-package-4158347e7fbf">How To Build A NPM Package</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[Session Authentication With Node.js, Express, Passport, and MongoDB]]></title>
            <link>https://javascript.plainenglish.io/session-authentication-with-node-js-express-passport-and-mongodb-ffd1eea4521c?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffd1eea4521c</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 10:16:26 GMT</pubDate>
            <atom:updated>2024-09-17T02:14:57.822Z</atom:updated>
            <content:encoded><![CDATA[<h4>A straightforward guide for Session-based Authentication.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*HdYg2XLQ_HufryAecb3VCw.png" /></figure><h4>Quick Note —</h4><p><em>I recently made a post walking through an authentication solution for JWTs. I made a disclaimer at the top of the post recommending people not use the post for production software. Instead, I promised I would walk through Session-based authentication, and I’m finally getting around to it.</em></p><p><em>Here is a link to the JWT Authentication tutorial: </em><a href="https://medium.com/@cambass/jwt-authentication-with-node-express-passport-and-mongodb-445a7fca5893"><em>JWT AUTHENTICATION</em></a></p><p>This session authentication tutorial demonstrates the fewest steps to implement session-based authentication in your Node.js application.</p><h4>Overview of Steps:</h4><p>First, we will create an app.js file that will include the necessary packages for session creation. We then add that session to the MongoDB Store (The database we use for this tutorial). It will also include the passport setup, which is very straightforward for our case. Lastly, we will include all the project-specific routes. I have kept the code as minimal as possible for the best chance to understand and build it out for your purposes.</p><p>Secondly, we will create a model creating the user and saving it to the MongoDB database VIA mongoose. That will include the ‘<a href="https://www.npmjs.com/package/passport-local-mongoose">passport-local-mongoose</a>’ simplifying the username and password authentication. I would recommend looking at how this package works to understand Passport at a deeper level.</p><p>Lastly, we will use Postman to validate that the session configuration is appropriately set up and the endpoints are working as expected. A screenshot will be included for this step.</p><p>Once all steps are completed, you should have your Node app ready for session-based authentication.</p><blockquote><em>👉 </em><strong>Want to build an AI chat app with Node.js? Learn how you can use Node.js and Gemini to do so:</strong></blockquote><p><a href="https://differ.blog/p/creating-a-command-line-ai-chat-app-with-node-js-and-google-gemini-803fae">Creating a command line AI chat app with Node.js and Google Gemini</a></p><blockquote><em>👉</em> To read more such acrticles, <a href="https://differ.blog/"><strong>sign up for free on Differ</strong></a>.</blockquote><h4>Technical Assumptions:</h4><ol><li>A running MongoDB cluster that you can connect with. We will be using mongoose — passport-local-mongoose — connect-mongo for our data store.</li><li>The latest versions for Node and NPM installed</li><li><a href="https://www.postman.com/">Postman</a> installed</li></ol><h3>Step 1: Create App &amp; Add Dependencies</h3><p>First, let’s create a new Node.js application and check out the packages we will use for this tutorial.</p><h4>Make a new project directory and create the Node app:</h4><pre>&gt; mkdir user-session-tutorial<br>&gt; cd user-session-tutorial<br><br>&gt; npm init</pre><p><strong><em>Note: I set my entry point to </em></strong><strong><em>app.js</em></strong></p><h4>Now let’s add the necessary packages:</h4><pre>npm install --save connect-mongo express express-session mongoose passport passport-local passport-local-mongoose</pre><h3>What is PassportJS? What is Middleware?</h3><h4>PASSPORT</h4><p><a href="https://www.passportjs.org/">Passport</a> is authentication middleware for <a href="https://nodejs.org/">Node.js</a>. Extremely flexible and modular, Passport can be unobtrusively dropped into any <a href="https://expressjs.com/">Express</a>-based web application. Passport supports many different authentication strategies that can be leveraged for straightforward implementation. This tutorial uses the “<a href="https://www.passportjs.org/packages/passport-local/">passport-local</a>” strategy for username and password authentication. Passport supports other strategies like Google OAuth, Twitter, AuthO, and many more. Here is a link to the <a href="https://www.passportjs.org/packages/">complete list</a>.</p><p>It’s also worth noting that Passport is database agnostic, we are using MongoDB for this tutorial, but any other database type can be used with almost as much ease.</p><h4>MIDDLEWARE</h4><p>Middleware is <strong>a way to filter a request coming into your application</strong>. A middleware component sits between the client and the server, processing inbound requests and outbound responses. In other words, it can manipulate data from the request and response before it gets to the client or server.</p><p>Middleware is handy for authentication and authorization, which is why Passport is widely adopted across Express-based applications. The app.js file below will demonstrate how we can implement Passport into a Node.js application.</p><h3>Step 2: Create an <em>app.js </em>file</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8a27b4dbd0e345514bb0f1125b6e356/href">https://medium.com/media/b8a27b4dbd0e345514bb0f1125b6e356/href</a></iframe><p>It will be good practice to move each of these components into their own files when developing for your purposes, but laying everything out flat here will make it easier to understand.</p><h3>Step 3: Create a User Model</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95487ff949dd8e839405f89515235f45/href">https://medium.com/media/95487ff949dd8e839405f89515235f45/href</a></iframe><p>Again, this user model is leveraging the passport-local-mongoose package to remove the need to handle hashing the password inside our application.</p><p>After this model is implemented, all necessary code should be set up, and we will be ready to test our endpoints. Let’s get to it!</p><h3>Step 4: Make requests VIA Postman:</h3><h4>Register Route: Create a user</h4><p>The first step for testing our endpoints will be creating a user. Let’s hit the /register route with the correct request body to accomplish this task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b7uz6FPj8chFjvEsPh-aZg.png" /></figure><p>We have successfully created the user. Let’s take a look at our MongoDB instance to ensure we have the document created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vxgZCjOXMCzqeVUo7ZvsRQ.png" /></figure><p>Our app created the user, and the next step is to login.</p><h4>Login Route: Create the session</h4><p>If we want access to protected routes, we need to have a valid session created to prove we are who we say we are. Let’s do that now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6cx-ZtLVyqQEqJ9tTzNnw.png" /></figure><p>Now let’s check MongoDB and check out the created session that will be used to validate the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4P5k5-C7Y3nhqecnbj9WEQ.png" /></figure><p>There it is. We have a session we can leverage to access the protected routes. Let’s give it a try.</p><h4>Profile Route: Protected. Only you can see this.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4hHspXqInzNAAuvfS5XyA.png" /></figure><p>We have made it to the protected route.</p><h4>Profile Route: Test Failure</h4><p>I will delete the session from my MongoDB store to ensure everything is configured correctly. After removing the session, this request should now fail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0UQMfzAjBmcx_KWY46riug.png" /></figure><p>After deleting the session, I can no longer log in and view the protected profile route.</p><h3>Wrapping up:</h3><p>Hopefully, this helped demonstrate the fewest steps necessary to add session-based authentication to your Node.js application. Happy Coding!</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffd1eea4521c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/session-authentication-with-node-js-express-passport-and-mongodb-ffd1eea4521c">Session Authentication With Node.js, Express, Passport, and MongoDB</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reviewing Jordan Peterson’s Essay Application]]></title>
            <link>https://medium.com/illumination/reviewing-jordan-petersons-essay-application-4dc6e187c060?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dc6e187c060</guid>
            <category><![CDATA[writing-tips]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[essay]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[jordan-peterson]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 02:53:33 GMT</pubDate>
            <atom:updated>2022-12-20T18:34:29.979Z</atom:updated>
            <content:encoded><![CDATA[<h4>“Essay” could help level up your writing skills.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*AMKTcJdmV6zwEP8jdpsB-w.png" /></figure><p>Believe and say what you want about Jordan Peterson. This review of “Essay” will omit any personal opinions about him. I aim to objectively appraise “Essay” and its utility without letting politics cloud the product’s value. I will say only one thing about Peterson in this review. He has always stressed the need for people to learn how to write well. In Peterson’s <a href="https://jordanbpeterson.com/wp-content/uploads/2018/02/Essay_Writing_Guide.docx">writing guide</a>, he states:</p><blockquote><em>If you want to have a life characterized by competence, productivity, security, originality and engagement rather than one that is nasty, brutish and short, you need to think carefully about important issues. There is no better way to do so than to write. This is because writing extends your memory, facilitates editing and clarifies your thinking.</em></blockquote><p>I’m a paying customer of what “Essay” calls the beta version, and I’ve used it to compose a few essays. So, I thought it might be helpful to share my experience thus far and do my best to summarize the highs and lows of “Essay.”</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXHIhtWPpDVI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXHIhtWPpDVI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXHIhtWPpDVI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/730bd3d0e582b23037741a2f1ba8035f/href">https://medium.com/media/730bd3d0e582b23037741a2f1ba8035f/href</a></iframe><h3>What is Essay?</h3><p>Years ago, Peterson wrote a practical “<a href="https://jordanbpeterson.com/wp-content/uploads/2018/02/Essay_Writing_Guide.docx">Essay writing guide</a>” for his students. The Essay web application aims to extract the main concepts of the writing guide into an intuitive format that will make it easy to apply the writing guide as you formulate your essays. While Jordan Peterson’s writing guide is the model for the application, Essay’s software has been built by a team led by Peterson’s son, Julian. So, users can trust Essay to stay true to the vision of Peterson’s writing guide as the system continues to grow.</p><h3>How to use it —</h3><p><a href="https://essay.app/">Go to Essay</a>. Upon arrival to Essay, you’ll notice the UI is clean and straightforward. The dashboard view includes a table view listing all of your essays. The dashboard table comes standard with an article titled “Tutorial • Learn to use Essay” that cannot be deleted. It is helpful at this point to read the tutorial and Peterson’s writing guide before starting your Essay. The simplicity of the application is a feature and can be misinterpreted if you do not understand the overarching concept of the application. It would be best if you appreciated Peterson’s Essay writing philosophy to get the most out of Essay.</p><h3>Features</h3><p>The application comes with four main tools, and each of these functions corresponds with Peterson’s writing guide; these tools are as follows:</p><p><strong><em>1. Outline</em></strong></p><p><strong><em>2. Produce</em></strong></p><p><strong><em>3. Rewrite</em></strong></p><p><strong><em>4. Reorder</em></strong></p><h4>Outline —</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3idP0Tezm9kN8PpPwzApMA.png" /><figcaption>Outline tool</figcaption></figure><p>The “Outline” tool is designed to start the essay writing process. According to the writing guide, writers should develop a central “topic question” and a list of questions they will need to answer about the main topic question to write a comprehensive essay.</p><p>The Outline tool gives you a friendly and simple interface for creating the outline of questions that will be assigned by color and allow you to see them organized in the sidebar and the central section, which is your essay.</p><p>Building a comprehensive outline is critical to writing an excellent essay. The outline tool does a great job of taking mental and structural organization off your plate and allowing you to focus on writing.</p><h4>Produce —</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jX_kgotjWohYRk58n5XnJA.png" /><figcaption>Produce tool</figcaption></figure><p>The “Produce” tool allows the writer an unobstructed view of their project without bells and whistles to distract them from producing content. When you initiate the “Produce” tool, the sidebar and organizational color will be removed, and the view will be cleared for the writer’s focus. The produce tool should be used after a comprehensive outline is already created.</p><h4>Rewrite —</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CToiaYmQ74xS7hq_EvOOQA.gif" /><figcaption>Rewrite tool</figcaption></figure><p>In my estimation, the “Rewrite” tool is handy but takes complete dedication to the process to utilize effectively. When the “Rewrite” tool is initiated, it will automatically duplicate each sentence of your essay in the sidebar. This function allows you to rewrite each sentence as often as you would like until you are happy with the result. You can pick between each rewritten sentence, and it will automatically place it within your essay to read along with the rest of the paragraph.</p><p>According to Peterson’s writing guide, rewriting is a powerful tool and an essential step in the process, but how do you know when you’ve rewritten enough to be finished? That is a good question, and Peterson addresses it well. Rewrite until you are confident that each rewritten sentence does not improve with each iteration. Continue to improve the sentence repeatedly until you are convinced you can enhance it no further. That sounded arduous to me, but once I attempted an earnest, it was well worth the effort.</p><h4>Reorder —</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*92pI0pO1GD53BTIXa6cziA.gif" /><figcaption>Reorder tool</figcaption></figure><p>The “Reorder” tool allows you to visualize each sentence in the sidebar and reorder it to its most appropriate position in the paragraph. “Reorder” can be used to test out new structures to ensure that every arrangement of your section can be considered thoroughly and efficiently.</p><h3>Pros &amp; Cons</h3><h4>Pros:</h4><p>1. Simple and straightforward design that will allow for optimal focus.</p><p>2. Following Peterson’s writing guide closely, this application will undoubtedly improve the overall quality of your work.</p><p>3. Quick and easy navigation from one tool to another.</p><p>4. Price — Extremely useful tool when implemented properly for $6 a month</p><h4>Cons:</h4><p>1. Organization of projects is lacking.</p><p>2. No sharing or communication from user to user.</p><p>3. No support for embedded images. I understand that essays do not include pictures, but for blog writing, it would be helpful if the system supported images.</p><h3><strong>Addressing Possible Improvements</strong></h3><h4><strong>Organization of projects —</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kg4ZCMXzwOLz8DIomI1j5w.png" /></figure><p>This is a view of the “Dashboard” — It’s practical and looks nice, but lacks organization. I write essays for philosophy, history, psychology, and sports. A hierarchical folder structure for projects would significantly improve usability from an organizational standpoint.</p><h4><strong>Social —</strong></h4><p>Adding a social component is no small update, I understand, but having the option to share work with friends for help editing would be an awesome upgrade to the system. Not to mention allowing for the posting of essays to the system would be great.</p><p>Essay is technically in beta. So, who knows what plans they have for the application in the future? I expect many more exciting updates.</p><h3>Summary</h3><p>“Essay” is only in its infancy, and its usefulness is already clear and present. If users study the writing guide provided by Jordan Peterson and apply the rules while writing their essays, Essay could become an essential tool for their writing process. I hope the Essay continues to grow and become more widely adopted, as I believe it has room to improve and become even more helpful in the future.</p><p>I recommend the usage of Essay to any dedicated writer for at least a trial attempt. It could become an essential tool for you as Essay now has become one for me.</p><h4>References:</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fl7b8ZOGBSqw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dl7b8ZOGBSqw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fl7b8ZOGBSqw%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b85bc7909c486d46a7867a6011b39ca/href">https://medium.com/media/1b85bc7909c486d46a7867a6011b39ca/href</a></iframe><h4>Writing Guide:</h4><p><a href="https://jordanbpeterson.com/wp-content/uploads/2018/02/Essay_Writing_Guide.docx">https://jordanbpeterson.com/wp-content/uploads/2018/02/Essay_Writing_Guide.docx</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dc6e187c060" width="1" height="1" alt=""><hr><p><a href="https://medium.com/illumination/reviewing-jordan-petersons-essay-application-4dc6e187c060">Reviewing Jordan Peterson’s Essay Application</a> was originally published in <a href="https://medium.com/illumination">ILLUMINATION</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better Dialogue: De Facto vs. De Jure Objections]]></title>
            <link>https://medium.com/illumination/better-dialogue-de-facto-vs-de-jure-objections-f6a9f133b3a5?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6a9f133b3a5</guid>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[culture]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 03:33:46 GMT</pubDate>
            <atom:updated>2022-11-29T03:33:46.675Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s still possible to bridge the political gap, but our discourse must improve.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JjFfMJ-QAQE8bJEP" /><figcaption>Photo by <a href="https://unsplash.com/@tingeyinjurylawfirm?utm_source=medium&amp;utm_medium=referral">Tingey Injury Law Firm</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It takes a cursory look at the current political sphere to see that disagreements on the fundamental aspects of society are vast and only seem to be growing further apart. Simultaneously, the ability to meaningfully communicate with our fellow humans has expanded in wondrous ways over the last half-century. The initial hope in the rise of technology was that the ability to share our ideas would, in turn, bring us closer as a species, and harmony we’ve never experienced before would be produced as a byproduct. This hope was unfounded, and the complete opposite occurred. How can this be true? At a time when we should be enjoying balance and symmetry, the reality is dysfunction and decay. Pointing fingers likely won’t resolve any issues; instead, we should consider having better discussions that hopefully begin narrowing the ideological gap that has grown unwieldy.</p><h4>De Facto vs. De Jure — Alvin Plantinga’s definition</h4><p>There are two terms that we will focus on in this article. They are related, but it’s essential to form a distinction that could unlock an ability to have better discourse with our ideological opponents. These terms are “De Facto” and “De Jure.” These terms have specific definitions. They are mainly used in the legal arena, for example:</p><blockquote>“De Facto” — In fact, or in effect, whether by right or not. (In reality)</blockquote><blockquote>“De Jure” — According to rightful entitlement or claim. (In law)</blockquote><p>It is worth one’s time to understand the difference between the terms in a classical sense. This article will attempt to look beyond the classical definitions of the terms and use the delineation defined by <a href="https://en.wikipedia.org/wiki/Alvin_Plantinga">Alvin Plantinga</a> in “<a href="https://www.amazon.com/Knowledge-Christian-Belief-Alvin-Plantinga/dp/0802872042">Knowledge And Christina Belief.</a>” There are two types of objections “The De Facto Objector” and “The De Jure Objector.” in this book, Alvin Plantinga uses the term “De Facto” vs. “De Jure” to convey objections to specifically Christian belief. He sets the stage for two positions, “the believer” and “the objector.” He makes the case that a belief can be purely and straightforwardly false, for instance, the idea that Santa Clause is real. Therefore, the De Facto Objector argues the existence of Santa Clause is incorrect, or at least highly improbable.</p><p>On the contrary, the De Jure Objector does not claim a belief is false. Although it could be, the De Jure Objector claims that the belief has a defect. The idea or belief is unjustified, foolish, immoral, or something else. First, understand if you are the believer or the objector. Suppose you are the objector, understand that De Facto vs. De Jure objection can tremendously impact the conversation and the likelihood of changing minds and influencing people.</p><h4>Why It Matters?</h4><p>One thing that all sides of the political spectrum do agree on is that we are too divided in our beliefs. It’s a funny thing to agree on, but if we plan to be the objector of an idea held by our opponent, we must filter it between De Facto and De Jure. Furthermore, we must be honest in our appraisal. Mentally, it is far easier to object to an opponent’s belief with De Facto judgment than to oppose with De Jure objection. De Jure Objection will force us to do some up-front work and point out the defects, thus defending our reasoning for labeling attributes of the belief as defects.</p><h4>Explanation in the political world</h4><p>At times, it is appropriate to make De Facto objections. People can and will hold false beliefs, and we should confidently make that objection when necessary. To pick an extreme example, a person might believe that the earth is flat. The objector may consider it appropriate for De Facto objection towards that belief. To use another contrived example, imagine someone believes collectivism is the most applicable principle to build a society. If you are the objector of collectivism, it is healthy to practice De Jure objection to such a claim. If implemented correctly, the objector would have to identify the defects of the claim they are objecting to and resolve their opposition coherently.</p><h3>Why Should We Implement De Jure Objection?</h3><h4><strong>1. Challenge Our Own Beliefs</strong></h4><p>Suppose we choose to make De Jure objections when appropriate. In that case, one of two things will occur, we will improve the foundation on which we make our beliefs and objections, meaning we will understand on a deeper level why we believe what we believe, or we will learn something that our minds were previously closed off to understanding. Using a previous example, if you find yourself objecting to the idea of collectivism being the appropriate principle to build the foundation of society, and you wish to implement De Jure objection, you will be forced to understand precisely what it means to support collectivism because you will have to itemize and formalize your protesting statements. Distilling your objections will either strengthen your previously held beliefs, or your mind may change to some capacity, and you learn ways your objections may not be fully considered.</p><h4><strong>2. Accomplishes Good Faith &amp; Empathy</strong></h4><p>Is it naive hopefulness to expect our dissenting ideological conversations to have an undertone of respect and understanding? Yes, it probably is. But discerning between De Facto and De Jure objection gives us a chance to lead in good faith discussions. We are far more likely to return the favor when people listen to us. If we sincerely try to understand another person’s political or ideological position, they are much more likely to listen and understand ours. In the 1936 formative self-help book by Dale Carnegie titled “How To Win Friends &amp; Influence People,” Carnegie spends much of the book emphasizing practice in empathy. He prominently mentions the influential quote from Henry Ford,</p><blockquote>“If there is any one secret of success, it lies in the ability to get the other person’s point of view and see things from that person’s angle as well as from your own.”</blockquote><p>This practice of empathy can be used for sales tactics, but there is no reason to think it can’t be deployed in our political conversations. Prudent consideration of our opponent’s ideological positions fosters warmth and openness and gives us the best chance to change our minds and bridge gaps.</p><h4>Wrapping Up —</h4><p>Discerning between the appropriate application of De Facto or De Jure objections boils down to basic empathic exercises. When discussing our political differences, it seems good practice to understand why you disagree with someone’s position entirely. To fully understand, you’ll need to do the work. We don’t owe this to our ideological opponents. Still, it’s a step towards trust and good faith, and one step forward towards harmony is undoubtedly better than one step back and allowing bitterness and anger to dictate our discussions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6a9f133b3a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/illumination/better-dialogue-de-facto-vs-de-jure-objections-f6a9f133b3a5">Better Dialogue: De Facto vs. De Jure Objections</a> was originally published in <a href="https://medium.com/illumination">ILLUMINATION</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JWT Authentication With Node, Express, Passport, and MongoDB]]></title>
            <link>https://cambass.medium.com/jwt-authentication-with-node-express-passport-and-mongodb-445a7fca5893?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/445a7fca5893</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Fri, 25 Nov 2022 01:15:17 GMT</pubDate>
            <atom:updated>2022-11-25T01:15:17.849Z</atom:updated>
            <content:encoded><![CDATA[<h4>A straightforward guide for a basic implementation of JWT authentication for a MERN application.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HloE7Aditch9pQVMdO0hww.png" /></figure><h4><strong><em>Disclaimer for this post!</em></strong></h4><pre>JWTs are not recommended for user sessions because they have many <br>security issues with their stateless nature. Many excellent blog <br>posts go in-depth with the problems. <br><br>This Blog post should only be used to further your understanding<br>of JWTs as they have their use cases and are a powerful tool when used<br>correctly. (Link below for great posts on the issues with JWTs)<br><br>I will be making another post in the near future with a walk-through <br>of a supported solution for user sessions and I will link it here when<br>it&#39;s ready.</pre><h4>Blog post on the dangers of using JWTs for user sessions:</h4><p><a href="https://redis.com/blog/json-web-tokens-jwt-are-dangerous-for-user-sessions/">JSON Web Tokens (JWT) are Dangerous for User Sessions — Here’s a Solution</a></p><p>With the warning out of the way, let’s get to this tutorial on wiring up JWTs with Node, Express, Passport, and MongoDB.</p><h4>Technical Assumptions:</h4><ol><li>A running MongoDB cluster that you can connect with. We will be using mongoosefor making the connection and passport local mongoose is a mongoose plugin that simplifies building username and password login with <a href="http://passportjs.org/">Passport</a>.</li><li>The latest versions for Node and NPM installed on your machine</li><li><a href="https://www.postman.com/">Postman</a> is installed on your machine</li></ol><h4>Step 1 — Create a project</h4><pre>&gt; mkdir jwt-auth-app<br>&gt; cd jwt-auth-app<br>&gt; npm init<br>&gt; npm install --save body-parser express jwt-simple mongoose passport passport-jwt passport-local passport-local-mongoose</pre><h4>Step 2 — Create a user model</h4><p>We will need to create a model for user creation. This should go in a models folder, in a file, called user.js — We use passport-local-mongoose to make username and password login with passport a little easier.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/275cd207c85f95a82e1df186f232a7eb/href">https://medium.com/media/275cd207c85f95a82e1df186f232a7eb/href</a></iframe><h4><strong>Step 3 — Create middleware</strong></h4><p>Next, we need to create a container for registering the JWT Strategy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55c8fe1ee15a077be858c81156f3ec4c/href">https://medium.com/media/55c8fe1ee15a077be858c81156f3ec4c/href</a></iframe><h4>Option params for the strategy:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d52a401ed3cdf846a04baf36e198a7e7/href">https://medium.com/media/d52a401ed3cdf846a04baf36e198a7e7/href</a></iframe><h4>Step 4 — Add the controller for the account routes:</h4><p>This will register the route functions used to log in, register, and visit the secured profile. This is under controllers/accountController.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a32fc154eea34f6a0a99a29dab74781/href">https://medium.com/media/6a32fc154eea34f6a0a99a29dab74781/href</a></iframe><h4>Step 5 — Set up app.js</h4><p>You will notice within lines 21-23 the routes are being called, and the account controller module functions are being called as the third parameter to the route function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b82008f4d781ed382e292b10910faa44/href">https://medium.com/media/b82008f4d781ed382e292b10910faa44/href</a></iframe><p>That concludes all the necessary code to start registering, logging in, and even a profile route protected by JWT authentication. Let’s test these new routes with Postman and ensure everything is configured correctly.</p><h4>Step 6 — Test the endpoints.</h4><ol><li><em>the registering endpoint</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qwd9g4vSr7YRynbk6jIkqQ.png" /></figure><h4><em>The created record in MongoDB:</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qjRPUtGdeXSGBtJL-zat0g.png" /></figure><p><em>2. The Login Endpoint:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45f9Nboel_5u1msrBray8w.png" /></figure><p>After a successful call to this endpoint, you will receive a token in the payload that can be used for the profile endpoint, for <em>example, below —</em></p><p><em>3. Protected Profile Endpoint</em></p><p><em>Successful GET request</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpQRduMvfIQUxwUZ3BPLOQ.png" /></figure><p><em>Unsuccessful GET request</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aYB0s_uCxMzgELaoTvR2uw.png" /></figure><p>There you have it! That is the straightforward setup I could muster for getting a JWT authentication going for a NodeJS application. There are many considerations to make when building this out further, but this is enough to get some successful requests and get started on the path to authenticating your application. Remember, JWT should not be used for user session, and I will post a follow-up with a supported route for user session authentication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=445a7fca5893" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction To PostgreSQL Backups With PSQL, pgAdmin & Heroku]]></title>
            <link>https://cambass.medium.com/introduction-to-postgresql-backups-with-psql-pgadmin-heroku-6bc63a8584ad?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bc63a8584ad</guid>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[postgres]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Thu, 17 Nov 2022 02:56:44 GMT</pubDate>
            <atom:updated>2022-11-17T02:57:29.588Z</atom:updated>
            <content:encoded><![CDATA[<h4>A how-to guide for primary PG backups and moving data from a production environment to local</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YTv1KRLQFbz6oqByzHyTLQ.png" /></figure><p>We often want accurate test data for our local environments when developing new features or fixing bugs. There are many ways to accomplish this goal. One of our favorite ways at <a href="https://www.advisoryalpha.com/">Advisory Alpha</a> is using Heroku’s <a href="https://devcenter.heroku.com/articles/managing-heroku-postgres-using-cli#pg-push-and-pg-pull">PG:PULL</a> command or running a <a href="https://www.postgresql.org/docs/current/app-pgdump.html">pg_dump</a> backup using pgAdmin. We use that command to pull the entire database to our local environment. Let’s walk through our flow for removing data from a specific table from our Staging and Production environments to our local systems.</p><h4>Technology this tutorial will utilize</h4><ol><li>Heroku (Not required)</li><li>PostgreSQL</li><li>PSQL</li><li>pgAdmin</li></ol><h4>Assumptions</h4><p>This tutorial assumes you already have pgAdmin installed and PostgreSQL installed.</p><h4>STEP 1: <strong><em>Hooking up Postgres database to pgAdmin</em></strong></h4><p>As mentioned above, we use Heroku for application deployment and configuration. Heroku provides an excellent <a href="https://devcenter.heroku.com/articles/heroku-postgresql">SQL database service</a> called “Heroku Postgres” — It gives CLI commands and a dashboard for query visualization and database management. This is where we will look; first, we need to find our database credentials and use those to sync with pgAdmin.</p><p>Here is the step-by-step process we take at Advisory Alpha to connect a Heroku Postgres DB to pgAdmin:</p><ol><li>Login to Heroku, navigate to the desired application, and open the “Heroku Postgres” addon:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*Xaqk8DJgmOBEf_n1BxgS-g.png" /></figure><p>2. Once on the Heroku Postgres dashboard, navigate to the “Credentials” tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*AXMMoNiCblMEgHFAh1D8gA.png" /><figcaption>Credentials page for Heroku Postgres</figcaption></figure><p>3. Sign in to pgAdmin, create a server group, then create a server within the newly created server group; you should see this modal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*_RKNkDHJCCmjWTTDxTe6Fw.png" /></figure><p>4. Input the corresponding credentials from Heroku in the pgAdmin fields. Once correctly configured, save the new database.</p><p>5. Open the database folder, open “schemas,” open “public,” and then find the database table you want to backup:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8AWCmg6uJt4O6p-eblIzA.png" /></figure><p>6. Give the backup a filename, set the format to “plain,” navigate to the “data/objects” tab, and configure the backup to only include the necessary files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLSDaMgxeRUlqAsf340MPw.png" /></figure><p>7. Once you save that backup to a file location, you are now ready to copy that to your local database.</p><h4>Step 2: Using PSQL locate the backup and set the local database</h4><p><em>PSQL is a terminal-based front-end to PostgreSQL. </em>It’s a great tool with so many features; I have not scratched the surface of the capability, but I usually use a GUI to interact with Postgres, but PSQL is capable of all the things pgAdmin is. I do recommend looking up PSQL and referencing the documentation <a href="https://www.postgresguide.com/utilities/psql/">here</a>.</p><ol><li>Open PSQL from the console. Open it in the local database to which you want to copy the backup. My local database has the name ‘advisor-squared_development’ here is how I access my local database from PSQL:</li></ol><pre>› psql -d advisor-squared_development<br>psql (14.6 (Homebrew))<br>Type &quot;help&quot; for help.<br><br>advisor-squared_development=#</pre><p>2. Use \i and locate the backup file like so:</p><pre>advisor-squared_development=# \i ../../../Desktop/test</pre><p>3. The file I saved the backup to was on the desktop under “test” — As you can see in the example above, this will copy the backup to my local database.</p><p>4. Press enter and the table will now be updated to your local database instance.</p><h4>Wrapping Up:</h4><p>That was a quick rundown of how we handle backups and pull data from a specific environment to our local databases. There are, of course, many ways to do this. If you want to remove the entire database from one domain to another, your best bet is Heroku pg:pull — but if you want to backup a specific table the tutorial above is a good option.</p><h4>Resources:</h4><ol><li>https://www.postgresguide.com/utilities/psql/</li><li>https://devcenter.heroku.com/articles/managing-heroku-postgres-using-cli#pg-push-and-pg-pull</li><li>https://www.postgresql.org/docs/current/app-pgdump.html</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bc63a8584ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Most Influential Play of LeBron James’ Career]]></title>
            <link>https://medium.com/top-level-sports/the-most-influential-play-of-lebron-james-career-a28cdd526aec?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a28cdd526aec</guid>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[entertainment]]></category>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[basketball]]></category>
            <category><![CDATA[sports]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Sat, 12 Nov 2022 22:11:04 GMT</pubDate>
            <atom:updated>2022-11-17T22:26:21.600Z</atom:updated>
            <content:encoded><![CDATA[<h4>The decision that helped save the NBA from a dark age and kickstarted a new era</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3Z6vAkE1w5Ls68nW" /><figcaption>Photo by <a href="https://unsplash.com/@abhishek_archie?utm_source=medium&amp;utm_medium=referral">Abhishek Chandra</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This evening was Lebron James’ first NBA game and the night of the most influential play of his career. The date was October 30th, 2003. NBA fans worldwide were excited about the long-awaited arrival of LeBron James into the league. Lebron was a prodigy, unlike anything the basketball world had ever seen. It would not take long for the NBA’s brightest young superstar to give the association precisely what it needed, a clear path forward.</p><h4>The NBA Context Surrounding LeBron’s First Game (2003)</h4><p>Michael Jordan recently retired for the third and final time, and the league was now fighting for an identity. It wasn’t all bleak. There were many bright spots. The league had young stars: Kobe Bryant, Tim Duncan, Kevin Garnett, Tracy McGrady, and Allen Iverson, to name only a few. The star power was bright, but the NBA culture was pulled in various directions. The inspiration and the league’s marketability were undecided, and the options available could have been detrimental to its growth for the foreseeable future.</p><h3>The Available Cultural Paths For The NBA Before LeBron’s Arrival</h3><h4><strong><em>1. Recreate the magic of Michael Jordan</em></strong></h4><p>Michael Jordan entered the NBA in 1984 and flipped the script. He was stylish, calm, and, most notably, an absolute killer on the court. The combination of determinism, athletism, and competitive spirit made him an instant success in the league. He would win six NBA championships and five most valuable player awards. Nineteen years after his NBA debut Michael Jordan retired for the third and final time. He was and continues to be considered the greatest player of all time. The NBA and its fans hoping that an MJ successor would emerge was not a bad dream, but there will only ever be one Michael Jordan, and leaning on the desire for a revivification of MJ would always remain a dream. The late great Kobe Bryant tried his best to keep the Michael Jordan style of basketball at the forefront. It would not be accurate to say he failed, but after Kobe’s career ended, it seemed to be for the best that the league didn’t follow Kobe Bryant’s lead direction.</p><h4>2. <strong><em>Points Per Game is King</em></strong></h4><p>During the 2001–2002 season, Allen Iverson averaged 44 minutes played a game, 28 shot attempts, and shot 39% from the field. He also led the league in scoring that season, but the 76ers would be bounced in the first round of the playoffs against the Boston Celtics. Iverson led the NBA in minutes played but not by much. Ten players that season averaged more than 40 minutes played a game, it was an unsustainable pace, but for the league stars, it was non-negotiable. The fanbase and the league front offices set the player value directly against your points per game and the inherent entertainment value each star brought to bear. That is not entirely unfounded. It’s essential to score points, and getting fans to the game will always be huge for basketball, but the quality of the play suffered immensely with this management style and culture. In retrospect, it was obvious that a more systematic and planned system would be needed to sustain the game and its players.</p><h4>3. Streetball style finding a home in the NBA</h4><p>Basketball is a highly artistic game. One of basketball’s strengths is the unique way the sport highlights the individual athlete’s ability. At the start of the new millennium, NBA sub-genres like “AND1 Mixtape Tour” brought “Streetball” into the limelight. This new permutation of basketball focused on the artistic side of the game. It was created and survived as a byproduct of NBA basketball. Streetball rules were only loosely applied, and regulations like traveling, carrying, and blocking were put to the wayside in favor of the excitement of the individual play-making ability. Streetball was great in a vacuum, but it started to seep back into the NBA. Team first basketball was being forgotten in the name of “breaking ankles,” and the NBA product was in danger of devolving into a fad rather than a timeless sport. Fortunately, this was not the way the NBA took, and LeBron James’ influence was fundamental to protecting the long-term integrity of the game.</p><h3>The Play That Defined The Next Generation</h3><p>Let’s return to the centerpiece of this article, back to October 30th, 2003. As previously stated, the anticipation for Lebron’s first game was off the charts, and for a good reason. LeBron was only 18 years old, already standing at 6&#39;8, 250lbs, and had a 40&quot; vertical leap. If anyone could lead this NBA in <strong><em>scoring</em> </strong>for the next two decades, it would be this kid. The game starts, and LeBron James is not disappointing the masses; on the contrary, he’s exceeding the expectation. He begins by throwing a beautiful lob to Ricky Davis and displaying his hailed court vision. Lebron then follows that up by sinking his first three midrange jumpers. He’s playing his first game against the great Sacramento Kings, and within the first quarter, he’s already performing like the best player on the floor.</p><p>With roughly three minutes left in the first quarter, LeBron reads a lazy cross-court pass attempt from Peja Stojaković; he steals it near half-court and slams it down at the other end for his first career dunk and his tenth point of the quarter. Back on defense, LeBron is guarding Doug Christie on the right wing. Christie tries to sneak around a pick, but LeBron notices and pokes the ball away from Christie. The ball falls into the hands of Carlos Boozer, LeBron’s teammate. LeBron streaks down the court and receives the pass for a wide-open lane to the basket, but what LeBron does next changes the game forever. LeBron doesn’t dunk the ball; on the contrary, he stops and passes the ball back to his teammate, Ricky Davis. Davis handles the pass and goes up for a behind-the-back dunk. It’s a play that could have gone unnoticed as it was somewhat benign, but to the cautious eye, LeBron gave audiences the first example of how he would conduct his play and lead the rising generation.</p><h3>The Play</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJLjH0rrNFeU%3Fstart%3D126%26feature%3Doembed%26start%3D126&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJLjH0rrNFeU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJLjH0rrNFeU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9411c29f61871dd5b57fcdb596411ee7/href">https://medium.com/media/9411c29f61871dd5b57fcdb596411ee7/href</a></iframe><h4>The Significance Going Forward</h4><p>Physically LeBron James has always been a freak, his athleticism off the charts since day one. After that pass to Ricky Davis, we wondered if LeBron’s most remarkable feature was his mind. An 18-year-old with the awareness to look for his teammates when everyone was hoping for a dunk showed unselfishness and team-forward vision that was all but lost in the NBA at the time. As LeBron’s career moved forward, his team play and court vision would be one of the most notable aspects of his game. During the initial seven years of LeBron’s career, he would lead the Cleveland Cavaliers deep into the playoffs and even to the finals in 2007. Aside from LeBron James, the Cleveland Cavaliers roster was below average from 2003–2010. Still, LeBron has now introduced a new way to gauge greatness, not just scoring and entertainment but instead, facilitation, and how one player can lift his teammate’s abilities along with his own.</p><h4>The New Culture Spearheaded By LeBron: “Efficiency”</h4><p>Before LeBron James entered the league, selfish, “me first” basketball was taking over and appeared it would reign for the foreseeable future. LeBron would show a new path to success, and it would not be taking every shot available simply because he was the best player on the team but trusting his teammates to take the best shot available on the court. We can see this trend bear out with the <a href="https://www.basketball-reference.com/about/glossary.html#:~:text=eFG%25%20%2D%20Effective%20Field%20Goal%20Percentage,for%2010%20with%200%20threes.">eFG%</a> rise over the years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*641OIRqHiRMyT3g1lyIPag.png" /><figcaption>League-wide eFG% Consistently Rising Throughout LeBron’s Career</figcaption></figure><p>It would be foolish to make the case that the rise in eFG% and FG% more broadly is all the doing of LeBron James, but he has indeed led the charge in culture change which has made it possible to see a more efficient game played. LeBron James has also taken criticism early in his career for deferring too much at critical moments in the game. Those critiques may have been fair, but LeBron has been dedicated to his approach of finding the best shot over the best player taking a bad shot for the entirety of his career.</p><h4>Efficiency On &amp; Off The Court</h4><p>LeBron James has enjoyed a long career. He has played much longer at a high level than any other superstar before him. His ability to achieve this is primarily due to his genetics, but we should recognize that he has also led a new effort to take top care of his body on and off-season. Many articles cite that LeBron James spends more than 1.5 million dollars each year providing care for his body. The league has followed suit in the acute care of the athlete’s bodies. The stress and strain put on the players’ bodies have been steadily decreasing since LeBron’s entrance into the league, and he can be credited for much of the change. Gregg Popovich has taken considerable criticism in his ongoing effort to relieve stress on his top players in preservation for late-season games, including the playoffs. The following graph shows a trend in minutes played by the NBA’s top stars.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KDEZz1RuS37ONIc2FqkW7w.png" /></figure><p>The tendency to lower the stress on the players has resulted in a better product on the court. However, coaches and team staff can take rest time to the extreme with players missing so many games that dedicated fans spending their hard-earned money going to the games can sometimes not be sure that their favorite players will even be suiting up because of rest. The emphasis on player health and safety has been a net positive for the league, and the culture shift LeBron brought forth has made it possible.</p><h4>Wrapping Up</h4><p>LeBron James is certainly not infallible; after all, he arguably mainstreamed the concept of the super-team to the NBA, and that’s had down-hill effects that have not all been good on the game. But we’ve learned in recent times that having a super-team doesn’t necessarily mean that team will be successful. As the super-team experiment continues, it’s not unimaginable that talent parity across the league will return as the rate of super-team failure seems to increase.</p><p>LeBron James reframed the NBA during his first showing, which will likely never be replicated by another player. LeBron favoring high basketball IQ over flashy plays has provided a blueprint for players like Kawhi Leonard, Giannis Antetokounmpo, Nikola Jokic, and Luka Doncic to have outstanding success in the league. The NBA will continually evolve, and it should. Nothing is guaranteed success in the future, but LeBron has been an exemplary leader for the NBA over the last two decades and helped bring solid, efficient play back into the mainstream. That has been an unmeasurable good for the NBA product. Before LeBron’s first game in the league, we were cautiously optimistic that the NBA world had found the new face of the league. With a deferring flip pass to Ricky Davis in the first game of LeBron’s NBA career, we all sighed in relief that he had arrived, and we buckled up for a fantastic ride.</p><p><strong><em>Resources:</em></strong></p><ol><li>https://www.basketball-reference.com/leagues/NBA_stats_per_game.html</li><li>https://www.youtube.com/watch?v=JLjH0rrNFeU</li><li>https://www.businessinsider.com/how-lebron-james-spends-money-body-care-2018-7</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a28cdd526aec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/top-level-sports/the-most-influential-play-of-lebron-james-career-a28cdd526aec">The Most Influential Play of LeBron James’ Career</a> was originally published in <a href="https://medium.com/top-level-sports">Top Level Sports</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building A Category Filter With ReactJS | MERN Stack]]></title>
            <link>https://cambass.medium.com/building-a-category-filter-with-reactjs-mern-stack-193f46ff385?source=rss-47267e6bbaa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/193f46ff385</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Cam Bass]]></dc:creator>
            <pubDate>Thu, 10 Nov 2022 13:29:31 GMT</pubDate>
            <atom:updated>2022-11-10T16:55:54.490Z</atom:updated>
            <content:encoded><![CDATA[<h4>Comprehensive step-by-step guide for one implementation of data filtering</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZvdqSMVOlkW32WjoyIXQ_g.png" /><figcaption>Visual Created In <a href="https://www.figma.com/">Figma</a></figcaption></figure><p>While building my website, the need for a category filter became apparent when searching for blog entries. I decided to keep track of my changes and post the result. Join along for a step-by-step walkthrough of my implementation.</p><h4>TECHNOLOGY ASSUMPTIONS:</h4><ol><li>An already-up-and-running ReactJS app</li><li>An already up-and-running NodeJS app with ExpressJS</li><li>MongoDB setup with documents to use and a connection to your NodeJS application already built.</li></ol><h4><strong><em>NOTE ON CONTINUATION OF PREVIOUS POST:</em></strong></h4><p>This is a continuation of my previous post: <a href="https://medium.com/@cambass/pagination-and-fuzzy-search-with-react-and-nodejs-c5fd5d0598aa">Pagination and Fuzzy Search With ReactJS</a></p><h4>LET’S GET GOING:</h4><p>Before we start the tutorial, let’s take a look at what we will be building:</p><h4>IMAGES OF THE CATEGORY FILTER:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFnncR-GCh7LnggBpRTBug.png" /></figure><h4>GIF OF THE INTERACTION:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCN3LfYiJIztOs35urCeew.gif" /></figure><p><strong><em>Technical overview of what we will be building:</em></strong></p><h4><strong>FRONTEND:</strong></h4><p>Four React Components —</p><ol><li>The Category Filter</li><li>The Category Filter Button</li><li>The Category Filter Dropdown</li><li>The Category Filter Multi-Select Input</li></ol><p><em>*I’ll also include my CSS file for anyone interested.</em></p><h4>BACKEND:</h4><p>Update ExpressJS endpoint —</p><ol><li>Add a query to return the applicable documents from MongoDB based on the category selections</li></ol><p>After we add these pieces, it will be clear how you can implement the same or similar solution in your application. Let’s get started.</p><h3>FRONTEND IMPLEMENTATION — REACTJS</h3><p><strong><em>STEP 1 — Add The Category Filter to the project</em></strong></p><p>WARNING: I’m going to add a bunch of code here. You can ignore most of it and I’ll highlight the applicable pieces.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e8888f49097663f8eb481f23133e088/href">https://medium.com/media/3e8888f49097663f8eb481f23133e088/href</a></iframe><p><strong><em>Applicable Code For This Tutorial:</em></strong></p><ol><li>On line 8 we import the CategoryFilter component.</li><li>On Line 18 &amp; 19 we add the applicable state to the component.</li><li>On Line 27 we encode the selected categories from the inputs and add them as query parameters to the backend endpoint.</li><li>On Line 29 we append the encoded categories to the query params of the request.</li><li>On Line 52 -- 61 we add the component to the return section of this component. You can see that we add the react hook state from lines 18 &amp; 19 to the CategoryFilter component</li></ol><p><strong><em>NOTE: As referenced above, all of the other code in this file can be understood by going back and reading my other article. The other pieces of code implement the pagination and text search for the elements we are displaying -&gt; </em></strong><a href="https://medium.com/@cambass/pagination-and-fuzzy-search-with-react-and-nodejs-c5fd5d0598aa"><strong><em>Pagination and Fuzzy Search With ReactJS</em></strong></a></p><p><strong><em>STEP 2 — The CategoryFilter Component</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/925035a76d686b63bbdab8fe4cd7cd58/href">https://medium.com/media/925035a76d686b63bbdab8fe4cd7cd58/href</a></iframe><p>In the CategoryFilter component we will add return two other components, the CategoryFilterButton &amp; CategoryFilterDropdown</p><ol><li>The CategoryFilterButton &amp; CategoryFilterDropdown will take the applicable state as props, shown in the example above.</li></ol><p>This component creates a button that users can click to initiate the dropdown, and the dropdown for users to select the categories they wish to filter on.</p><p><strong><em>STEP 3 — The </em></strong><strong><em>CategoryFilterButton component</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbce2acd58fc5dcc787bf912b7cbcf8b/href">https://medium.com/media/dbce2acd58fc5dcc787bf912b7cbcf8b/href</a></iframe><p>This CategoryFilterButton component will set the setMultiSelectExpanded state to true and false — Flipping that state will expand the CategoryFilterDropdown from open to closed show in the GIF at the top of this tutorial.</p><p><em>NOTE: The “arrow.svg” included in this file is a basic down carrot that is shown above in the example of the button. We will rotate it 180 degrees when clicked to spice up the component on click.</em></p><p><strong><em>STEP 4 — The </em></strong><strong><em>CategoryFilterDropdown component</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/773068baa71b0fb891bada29b457f227/href">https://medium.com/media/773068baa71b0fb891bada29b457f227/href</a></iframe><p>Noted pieces of the CategoryFilterDropdown —</p><ol><li>On Lines 9 — 14 we set the state for the category inputs, the Labelto be shown for the input and the Valueto be sent to the server in the query params.</li><li>On. Lines 22 — 30 iterate through the categories and generate the inputs through the CategoryInput component.</li><li>Pass the currentCategories &amp; categoryQuery state to the category input component.</li><li>We pass the index to the component to be used as the key for each input.</li></ol><p><strong><em>STEP 5 — The </em></strong><strong><em>CategoryInput Component</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88fda14e8ddea188c6556acfe3265e0b/href">https://medium.com/media/88fda14e8ddea188c6556acfe3265e0b/href</a></iframe><p>Noted pieces of the CategoryInput component:</p><ol><li>On Lines 6 — 14 we update the array of selected categories when clicked. The onChange gets fired and calls the handleChange function every time an input is clicked. This will remove and add them to the array of state called currentCategories that is used all the way up in our top-level component to send via the query params to the backend server.</li><li>On Lines 16 — 18 we created a function called checkedInput that will ensure when we open the dropdown the correct checkboxes will be selected based on the current state of the categories.</li></ol><p>That wraps up the frontend of this tutorial, once that is implemented you should be able to see and interact with the “category filter” component. Now let’s wire it up with our backend.</p><h3>BACKEND IMPLEMENTATION — NODEJS, EXPRESSJS, MONGODB/MONGOOSE</h3><p><strong><em>STEP 1 — Update the ExpressJS endpoint to expect the categories sent from the Frontend</em></strong></p><p><em>*Note: This tutorial assumes you have a NodeJS backend with ExpressJS, MongoDB, and Mongoose</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/513e8f4b5752d7f046e4997a1afb3b5d/href">https://medium.com/media/513e8f4b5752d7f046e4997a1afb3b5d/href</a></iframe><p><strong><em>Applicable pieces of this route file:</em></strong></p><ol><li>On Line 13 we parse the array of categories sent from the frontend, we then will pass those categories to the mongoose find function and return only the applicable posts that includes one of the categories sent from the React UI.</li></ol><p>NOTE: Here is my post.js set up for Mongoose and MongoDB:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/662f6d24d05b1bb633ef6db4c257b007/href">https://medium.com/media/662f6d24d05b1bb633ef6db4c257b007/href</a></iframe><ul><li><strong><em>Note — Here is an example of a post document in MongoDB:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*ckwUWHTlL-bnzLtSTud1lw.png" /></figure><p>That wraps up this tutorial on filtering with ReactJS — Hopefully, you have found this helpful when implementing your filtering solution. <br>Let me know if you noticed something I missed or have any questions!</p><h4>EXTRAS:</h4><ul><li><strong><em>Here is the CSS file used to build the CategoryFilter Component and all the children components: </em></strong>USE IT AT YOUR OWN CAUTION, I DIDN’T SPEND TOO MUCH TIME ON THIS PART BUT THOUGHT IT WOULD BE USEFUL TO SHOW.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/41fdb8dc87aea6d417f308694a7a1a9e/href">https://medium.com/media/41fdb8dc87aea6d417f308694a7a1a9e/href</a></iframe><h4>ClickAwayListener:</h4><p>Notice on line 52 of the first component shown, index.js we include a component called ClickAwayListener that is a plugin -&gt;<a href="https://mui.com/base/api/click-away-listener/"> ClickAwayListener API</a>.</p><p>It’s super easy to install and use, it basically handles a request whenever you don’t click on the surrounding component. This was perfect for the Category Filter Button because we wanted to close the dropdown whenever it was opened and a click event was fired outside of the button.</p><p>You can see on line 44 — 46 we handle the click-away and update the state to close the expanded dropdown. It’s a pretty neat plugin, I recommend it for this type of interaction.</p><h4>RESOURCES:</h4><ol><li><a href="https://mui.com/base/api/click-away-listener/">https://mui.com/base/api/click-away-listener/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=193f46ff385" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>