<?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 Payton Burdette on Medium]]></title>
        <description><![CDATA[Stories by Payton Burdette on Medium]]></description>
        <link>https://medium.com/@paytonburd?source=rss-79600d76f075------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AauK9Qg0oHIhMsiqUpO8MQ.jpeg</url>
            <title>Stories by Payton Burdette on Medium</title>
            <link>https://medium.com/@paytonburd?source=rss-79600d76f075------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 07:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paytonburd/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[JavaScript Data Structures — Linked List]]></title>
            <link>https://medium.com/@paytonburd/javascript-data-structures-linked-list-dfff7de255ad?source=rss-79600d76f075------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfff7de255ad</guid>
            <category><![CDATA[linked-lists]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Payton Burdette]]></dc:creator>
            <pubDate>Tue, 04 Dec 2018 21:33:40 GMT</pubDate>
            <atom:updated>2018-12-05T13:17:56.510Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript Data Structures — Linked List</h3><p>A data structure is a way to store and organize data. The way you organize that data is up to you.</p><h3>What is a Linked List?</h3><p>Today we are going to talk about Singly Linked List data structures and how to implement them in JavaScript. A Singly Linked List is a collection of nodes where each node has a direct reference to the next node in the collection. The first node in the list is referred to as the <strong>head</strong>, and the last node in the list is referred to as the <strong>tail</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*JHPxqFr1By3kuN_CmqZiRA.png" /></figure><h3>The Node Class</h3><p>A node can be visualized as one of the ‘boxes’ in the diagram provided above. A node is just a plain JavaScript object with two properties.</p><p><strong>data</strong>: the value of the node</p><p><strong>next</strong>: a direct reference to the next node in the list</p><p>Let’s start off by implementing a node in JavaScript. I’ll be using <strong>classes</strong> to implement the Singly Linked List. You can use functions as well, but I just prefer using a class for my template.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b56aa7ec217a5257fc4f145e182c199/href">https://medium.com/media/8b56aa7ec217a5257fc4f145e182c199/href</a></iframe><p>The above code is creating a Node class with a constructor, it receives data, which is the value that will be stored in the node. The next property is <strong>null</strong> by default, because we don’t know what the next node is in the list yet.</p><h3>LinkedList Class</h3><p>Okay, now since we can create nodes with data, we need somewhere to put those nodes. Lets create the linked list class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12f5a107001bc7908e0a100a2671de87/href">https://medium.com/media/12f5a107001bc7908e0a100a2671de87/href</a></iframe><p>The above code is creating a LinkedList class with a constructor, the constructor receives no arguments. Both head and tail are set to null by default. The length property is set to ‘0’ by default because the list has no nodes.</p><p>Okay, great we have two classes, one to create the nodes and one to store them. But how do we exactly store a node in the list? Well we need methods with functionality to do that.</p><h3>The Methods</h3><p>We will be adding six methods to the LinkedList class.</p><p>push(value) — Add a node on the end of the linked list</p><p>pop() — Remove a node from the end of the linked list</p><p>get(index) — Return a node at a specified index</p><p>delete(index) — Delete a node at a specified index</p><p>isEmpty() — Return true or false, based on the list length</p><p>print() — Return a visible representation of the linked list</p><p>I’ll be writing all the methods separate for cleanliness, take note that these methods all are within the LinkedList class.</p><h3>The push method</h3><p>Let’s tackle the first method in the list above, push(). That way we can put nodes in the LinkedList.</p><p>The push method adds a node to the end of the list. It’s one of the easier methods to implement. The push method receives one argument, the value of the node.</p><p>Here’s what it should do.</p><ol><li>Create a new node</li><li>Check to see if the head exists, if not the node is both the tail and the head.</li><li>Set the current tails next property to the new node, since the new node will be added to the end of the list.</li><li>Set the tail, to the new node.</li><li>Increment the length property</li></ol><p>Here’s how we do that in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5e28f2ae82727c1e72c1f097176a06a/href">https://medium.com/media/f5e28f2ae82727c1e72c1f097176a06a/href</a></iframe><h3>The isEmpty method</h3><p>Awesome, now we have the ability to add nodes to the linked list. Lets implement the isEmpty method. This ones super easy :)</p><p>Here’s what it should do:</p><ol><li>Return true or false, based on the list length</li></ol><p>Here’s how we do that in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/970fe64b82e92a7458b4ebbdad39c69a/href">https://medium.com/media/970fe64b82e92a7458b4ebbdad39c69a/href</a></iframe><h3>The pop method</h3><p>The pop method is a little more complex since we will need to know the penultimate node to pop off the last node in the list. At this point you may be wondering why can’t I just access the last index or other methods like I’ve used on an Array before?</p><p>One of the downfalls of a linked list is traversal, you have to start at the head node and move through each node in the list. You can’t simply use arr[2] to access a node in the list. I’ll cover some benefits and tradeoffs of a linked list at the end of this article.</p><p>Here’s what the pop method should do:</p><ol><li>Return null if the list is empty</li><li>If the head is the tail, set both the head and the tail to null. Decrement the length of the list and return the tail</li><li>Find the penultimate node and set it’s next property to null.</li><li>Set the tail to the penultimate node</li><li>Decrement the length and return the deleted node</li></ol><p>If you’re like me a visual graph will help you understand what exactly needs to happen here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*sDt17291lm0QUrVft-AaYg.png" /></figure><p>We need to find the penultimate node and set it’s next property to null, now the old tail will be garbage collected and the penultimate becomes the new tail.</p><p>Here’s how we do that in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/987897cd72300e71d344c381ca4c7152/href">https://medium.com/media/987897cd72300e71d344c381ca4c7152/href</a></iframe><h3>The get method</h3><p>The get method receives one argument, a index. Here’s what it should do:</p><ol><li>If index is 0, return the head</li><li>If index is less than 0 or index is greater that the list length, return null</li><li>Find and return the node at the provided index</li></ol><p>Here’s how we do that in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7804693491746e5b86e34f1f23a02c6/href">https://medium.com/media/c7804693491746e5b86e34f1f23a02c6/href</a></iframe><h3>The delete method</h3><p>The delete method receives one argument, a index. Here’s what it should do:</p><ol><li>If index is 0, set the current nodes next property to the head. (the next node in the list will become the new head). Decrement the length and return the deleted node.</li><li>If index is less than 0 or index is greater that the list length, return null</li><li>Find the node before the node that needs to be deleted, set its next property to the next property of the node that needs to be deleted.</li><li>Decrement the length property and return the deleted node</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*pxHJ3CdJvQ_-itVOvYDVVw.png" /></figure><p>Here’s how we do that in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8073f792131fc69a4d8d8181e71b5dc8/href">https://medium.com/media/8073f792131fc69a4d8d8181e71b5dc8/href</a></iframe><h3>The print method</h3><p>The last method we are going to implement is the print method. It’s more of a visual helper, rather than providing any functionality to the data structure.</p><p>Here’s what it should do:</p><ol><li>Return all nodes joined by an arrow</li></ol><p>Here’s how we do that in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e94b24f9b5a6d6ce2341673e15a81095/href">https://medium.com/media/e94b24f9b5a6d6ce2341673e15a81095/href</a></iframe><p>If we had three nodes in the linked list, A, B and C. We can now visualize what is going on like this ‘A =&gt; B =&gt; C</p><h3>The Complete Implementation</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e39999e001500e5860322de0f8861f8c/href">https://medium.com/media/e39999e001500e5860322de0f8861f8c/href</a></iframe><h3>How do we use it?</h3><p>All you have to do is create a variable and assign it to a new instance of the LinkedList class.</p><p>Now just use that variable and the methods provided on the LinkedList class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a82d86392c52ac54b6df2b49f6caab5f/href">https://medium.com/media/a82d86392c52ac54b6df2b49f6caab5f/href</a></iframe><h3>Closing Statement</h3><p>Insertions and deletions in a linked list are super fast. Linked lists are dynamic and very flexible. But you shouldn’t use a link list everywhere, for instance they are really slow when it comes to traversal. There is also no way to randomly select a node out of a linked list, like you can in an array.</p><p>A good use case for a linked list data structure would be a music player. If a user hits the next button, you move the next song in the list. A node could be a song and it’s next property could be a reference to the next song in the list.</p><p>Hit me up on <a href="https://twitter.com/beardedpayton">Twitter</a> if you have any questions or just want to chat about code and data structures!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfff7de255ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding ‘this’ in JavaScript in 5 minutes or less]]></title>
            <link>https://medium.com/@paytonburd/understanding-this-in-javascript-in-5-minutes-or-less-34ea42363bff?source=rss-79600d76f075------2</link>
            <guid isPermaLink="false">https://medium.com/p/34ea42363bff</guid>
            <category><![CDATA[this]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Payton Burdette]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 16:42:12 GMT</pubDate>
            <atom:updated>2018-11-05T16:43:54.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wHrewC1Dyf2Au_qEqwWcg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/B3l0g6HLxr8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Blake Connally</a> on <a href="https://unsplash.com/search/photos/javascript?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>If you’re new to the JavaScript language you’ve probably been stumped a few times with the <strong>‘this’</strong> keyword. I’m here to lift that burden from you and lay it out in hopefully a very easy way to understand.</p><p>The first rule in understanding what the hell <strong>‘this’</strong> means in JavaScript, is knowing exactly where the function was <strong>invoked</strong>. Look at <em>line 9</em> in the code snippet, that is where the function is being invoked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d9f8a6308df6c405e3f6f5f7d0071f4/href">https://medium.com/media/2d9f8a6308df6c405e3f6f5f7d0071f4/href</a></iframe><p>If you can wrap your mind around <strong>context, </strong>it’s a lot easier to understand. <strong>Context </strong>simply means “the <strong>object</strong> in which a <strong>method </strong>belongs to”.</p><p>The method <strong>speedUp</strong> belongs to the <strong>car</strong> object in the above code snippet, therefor <strong>speedUp </strong>runs in the <strong>context</strong> of the <strong>car </strong>object.</p><p>Since the <strong>speedUp</strong> function is running in the <strong>context</strong> of the <strong>car</strong> object, it belongs to the <strong>car </strong>object therefor the <strong>‘this’</strong> keyword will refer to the <strong>car </strong>object.</p><p>A simple way to know what <strong>‘this’</strong> refers to is look to the <strong>left of the dot</strong> where a function is being invoked. Whatever is to the left of the dot, will be what <strong>‘this’</strong> is. That is true when <strong>implicit binding</strong> is taking place.</p><p>What if you need to know what <strong>‘this’</strong> is bound to with <strong>explicit binding</strong>? The same thinking process takes place.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8baaf7b85f4766b41bfc75b19c8571e8/href">https://medium.com/media/8baaf7b85f4766b41bfc75b19c8571e8/href</a></iframe><p>Here we use the <strong>.call </strong>method to explicitly tell the <strong>speedUp</strong> function to run in the <strong>context</strong> of the<strong> car</strong> object. And guess what? We know that <strong>context</strong> means the <strong>object</strong> in which a<strong> method </strong>belongs to. So we explicitly told the <strong>speedUp</strong> function we want you to <strong>belong</strong> to the <strong>car </strong>object. Now <strong>‘this’</strong> will be the <strong>car</strong> object.</p><p>Do note that <strong>arrow functions</strong> will ignore methods like <strong>.call</strong> and <strong>.apply</strong> since they are <strong>anonymous</strong>.</p><p>Find me on <a href="https://twitter.com/beardedpayton">Twitter </a>if you have some other use cases you are confused about I’d love to help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34ea42363bff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Badass Array Methods With Real Use Cases]]></title>
            <link>https://medium.com/bytesizedcode/5-badass-array-methods-with-real-use-cases-3a283c8cb24?source=rss-79600d76f075------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a283c8cb24</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Payton Burdette]]></dc:creator>
            <pubDate>Wed, 30 May 2018 14:13:32 GMT</pubDate>
            <atom:updated>2018-07-13T17:35:12.679Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QcAh45dlS_pwW6wvoS7JOQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/0nI1DczRQAM?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ilija Boshkov</a> on <a href="https://unsplash.com/search/photos/code?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Let’s talk about <strong>5 Badass Array Methods </strong>that will make your life a hell of a lot easier when programming. I’ll even do you another solid and give you a <strong>real use case</strong> with each method. If you’re a veteran JS developer you’ve already used these methods and the only benefit you may get from this article is a use case. But I hope you stick around and read either way :)</p><h3>#1 .forEach()</h3><p>The <em>.forEach()</em> method comes in handy when you want to manipulate some data but you don’t need to return any data. All this method does is executes a function (that you provide) once for each element in an array.</p><h4>Use Case</h4><p>We have four buttons on a page. We need to attach an event listener to all of the buttons to make some jazz happen when one is clicked.</p><p>We will need to grab those buttons on the page and send them through .<em>forEach()</em> to solve our problem. Using the <em>.querySelectorAll() </em>method returns us a <em>NodeList</em> which we will treat just like an array. We store that NodeList into a variable so we can send it through the <em>.forEach()</em> method.</p><p>We cycle over each button in the array and add an event listener to each button that logs the button at a particular index when clicked. That was pretty easy and of course you’ll want to do something cooler than logging the index to the console.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a86b955ff8c4c99e717db6297b0307f/href">https://medium.com/media/3a86b955ff8c4c99e717db6297b0307f/href</a></iframe><h3>#2 .reduce()</h3><p>The <em>.reduce() </em>method is helpful when we want to reduce data down to a single value. This method simply applies a function against an accumulator (gathers the values) and each element in the array to reduce it to a single value.</p><h4>Use Case</h4><p>We are dealing with a shopping cart with multiple line items and we need to give the customer a single total value for checkout. We have an array of the line items purchase prices. We will need to write a function to provide to the <em>.reduce() </em>method that will handle two arguments accumulator and currentValue.</p><p>Once we have written that function to give the <em>.reduce()</em> method all we have to do is call the reduce method on our array and pass the newly created function to the method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddb798b9cf4fcad4733d600e281974fa/href">https://medium.com/media/ddb798b9cf4fcad4733d600e281974fa/href</a></iframe><h3>#3 .map()</h3><p>The <em>.map() </em>method is useful if we need to make changes to data and return that data in a new array. A good rule of thumb is to never manipulate your core data. Simply make a copy of that data with any changes. The <em>.map()</em> method creates a new array with the results of calling a provided function on every element in the array.</p><h4>Use Case</h4><p>We have an array of objects for users. Without corrupting the original data we would like to add a new group property to this set of users. We could achieve this with less code and much easier with the <em>.forEach() </em>method we mentioned earlier, but that would not return us a new array. We should create a new variable to store the array of objects in. That new variable should map over the users array and return a new object with the current properties and one new property for the group rights.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f89782ff59c803ddcfe64dc2506ee92e/href">https://medium.com/media/f89782ff59c803ddcfe64dc2506ee92e/href</a></iframe><h3>#4 .filter()</h3><p>The <em>.filter()</em> method is super helpful when you need to filter through a data set and return only the data you need. This method creates a new array with all elements that pass the user implemented function.</p><h4>Use Case</h4><p>We need to return data to a user based on search terms. Those search terms are tracked through an input in the UI. We filter our data based on the search terms and return only the data the user is requesting.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0d03279341aa671308d480c8e8f34d7/href">https://medium.com/media/a0d03279341aa671308d480c8e8f34d7/href</a></iframe><h3>#5 .some()</h3><p>The <em>.some()</em> method is helpful when you are looking for a truthy value in data. A great thing about this method is it will exit immediately once an element in your data returns true. The <em>.some()</em> method executes a function once for each element in an array until it finds one with a truthy value.</p><h4>Use Case</h4><p>We will reference our use case for the .<em>map()</em> method. We need to do a quick check on our data to see if a particular user group has a certain property.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d53675b78a2c26d98416cd126a4894d/href">https://medium.com/media/9d53675b78a2c26d98416cd126a4894d/href</a></iframe><p>Thanks for reading! If you’d like to hear more of my rambles about code, consider giving me a follow on <a href="https://twitter.com/beardedpayton">Twitter</a>!</p><p><strong>Byteconf React is a free React/JavaScript conference, streamed on Twitch</strong>. Join us on August 31, 2018, to hear from the best React developers and teachers from around the world. <a href="https://byteconf.com/">Join our mailing list</a> and <a href="https://twitter.com/byteconf">follow us on Twitter</a> to stay up to date!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a283c8cb24" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bytesizedcode/5-badass-array-methods-with-real-use-cases-3a283c8cb24">5 Badass Array Methods With Real Use Cases</a> was originally published in <a href="https://medium.com/bytesizedcode">Bytesized Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project setup for a full-stack JavaScript web application]]></title>
            <link>https://medium.com/@paytonburd/project-setup-for-a-full-stack-javascript-web-application-64f75670789b?source=rss-79600d76f075------2</link>
            <guid isPermaLink="false">https://medium.com/p/64f75670789b</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Payton Burdette]]></dc:creator>
            <pubDate>Sat, 10 Feb 2018 19:09:41 GMT</pubDate>
            <atom:updated>2018-05-30T14:18:02.484Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you getting ready to start your first full-stack web app? Or maybe your confused on the hierarchy? The initial setup of a web application is arguably one of the most important parts of a project. In this article, I’m going to give my take on setting up a full-stack app.</p><p>I specifically will be using Vue on the front-end, Express, Node and Sequelize on the back-end. Let’s get started!</p><p>I’m assuming you have used GitHub and know the terminology. First you’ll want to go ahead and create a repo. I’m naming mine <em>shalltear </em>(I’m a huge fan of Japanese anime). Then clone that repo down to your local machine so we can get started on the initial setup.</p><p>Let’s create a quick <strong>.gitignore</strong> file in the project root before we forget and push up all our node_modules to GitHub.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3843d873b81b3271d5195b16137d89b6/href">https://medium.com/media/3843d873b81b3271d5195b16137d89b6/href</a></iframe><h4>Getting started setting up the client</h4><p>I’ll be using <a href="https://github.com/vuejs/vue-cli">vue-cli</a> to quickly scaffold out a boilerplate for the front-end. Let’s name this project “<strong>client”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sRm_eRUO6Rze-8F4yMnGQ.png" /><figcaption>vue init webpack client</figcaption></figure><p>Now would be a great time to install any dependencies you know you’ll want for your project. I’m just going to start off with <a href="https://www.npmjs.com/package/axios">axios</a> a promise based http client for the browser and node. Since we are installing this for the client side of this application, make sure you are in the <strong>client</strong> directory when installing any production or dev dependencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mqrxfn2zCcpxcM_N2SWC1w.png" /></figure><p>Let’s create a services folder now that will hold all of our services for API call’s to the server side of this project. Inside of the services folder, let’s start off by creating an api.js file that will hold our baseURL for API calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BFNdSXjm8_U50eb4sO_3IA.png" /></figure><p>In api.js we can import the axios module and create an axios instance. Where we will pass in an object with the property baseURL and the value of our API url. The vue-cli is configured for the client to run on port 8080 so I usually like to set my server to run on port 8081, we will set that up shortly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da57ed186bb374a3a1928fa85b007677/href">https://medium.com/media/da57ed186bb374a3a1928fa85b007677/href</a></iframe><p>Okay let’s test that everything is working properly so far on the client side. In your terminal make sure you are in the project folder and cd into the client directory. Now run the script that’s already setup in your package.json file. Enter the script <strong>npm run dev</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5qQZcz9ph_2M-JhV9gMPg.png" /></figure><p>Visit <a href="http://localhost:8080/#/">http://localhost:8080</a>/ and you should see that your Vue.js application is running properly :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jGVv4hhzRKr8_EbbP-0K4g.png" /></figure><h4>Getting started setting up the server</h4><p>Let’s create a new folder in our project root called <strong>server </strong>and run <strong>npm init </strong>to create ourselves a separate package.json file. Now we can have two separate worlds for <strong>client</strong> and <strong>server</strong>. You should have your root project and two folders now <strong>client</strong> and <strong>server</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sjN4RaD2IppTvHcRomm5VQ.png" /></figure><p>I won’t be scaffolding out a server boilerplate, instead we will be creating a simple one ourselves to get started. So let’s start off by installing a few dependencies with npm. <a href="https://www.npmjs.com/package/express">Express</a>, <a href="https://www.npmjs.com/package/body-parser-json">Body-Parser</a>, <a href="https://www.npmjs.com/package/cors">Cors</a> and <a href="https://www.npmjs.com/package/morgan">Morgan</a>. Make sure you are in the <strong>server</strong> directory when installing modules for the server side of this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Upg-sH_FA3_pqdf_VrF5UQ.png" /></figure><p>Now let’s install a few helpful dev-dependencies that you’ll most likely want to have on hand for every project. <a href="https://www.npmjs.com/package/nodemon">Nodemon</a> and <a href="https://www.npmjs.com/package/eslint">eslint</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fkvp0QvmlJvBZ4BCFcXT6A.png" /></figure><p>Let’s setup a config file for eslint. I like to use a standard style guide for JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4K5o5S7aLhCzH1ia6rvICQ.png" /></figure><p>Now let’s navigate to our package.json file in our server directory to write a script we can run to have our <strong>server</strong> up and running properly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1587a2ce2ce6b9cdb81841718c7f9c0/href">https://medium.com/media/e1587a2ce2ce6b9cdb81841718c7f9c0/href</a></iframe><p>Let’s now create a <strong>src</strong> folder inside our <strong>server</strong> directory, this folder will hold the bulk of our server functionality. Inside of the <strong>src</strong> folder I usually like to start off by creating <strong>config</strong>, <strong>controllers</strong>, <strong>models</strong> folders and a root<strong> app.js</strong> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t88AB3bw_Gg9713Z-bWgPw.png" /></figure><p>The <strong>config</strong> folder will hold your configuration for connecting to your database.</p><p>The <strong>models</strong> folder will hold all our models. In short your data that you query for the endpoints that you will be able to access through API calls on the client side.</p><p>The <strong>controllers</strong> folder will hold all of the logic for how we respond to http requests from a browser.</p><p>We will go into more detail during the next few articles on creating the rest of the functionality for the server. The purpose of this article is to just get your environment up and running.</p><p>Let’s write a quick ‘Hello World’ to see if our server is running properly. Open app.js and write a console.log statement.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f22eaa72bb427166688db81059b0255/href">https://medium.com/media/1f22eaa72bb427166688db81059b0255/href</a></iframe><p>Finally we will navigate to the <strong>server</strong> directory and run the command <strong>npm start</strong>. We set this script up earlier in our package.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmcVzMyI6KO_wR14Phzepg.png" /></figure><p>AWESOME! We now have a working client and server for our full stack application. You can keep two terminal windows open running both the client side and the server side.</p><p>I hope this article was helpful to you in some way. Feel free to follow me on <a href="https://twitter.com/beardedpayton">Twitter</a> or <a href="https://github.com/beardedpayton">GitHub</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64f75670789b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>