<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jay Koontz</title>
    <description>The latest articles on DEV Community by Jay Koontz (@jkoontz).</description>
    <link>https://dev.to/jkoontz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F692079%2F7e3431cd-fe27-48e3-8856-7db5c520932b.jpeg</url>
      <title>DEV Community: Jay Koontz</title>
      <link>https://dev.to/jkoontz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jkoontz"/>
    <language>en</language>
    <item>
      <title>Senior Software Eng (web) looking to take on apprentice</title>
      <dc:creator>Jay Koontz</dc:creator>
      <pubDate>Wed, 29 Sep 2021 20:03:51 +0000</pubDate>
      <link>https://dev.to/jkoontz/senior-software-eng-web-looking-to-take-on-apprentice-b4d</link>
      <guid>https://dev.to/jkoontz/senior-software-eng-web-looking-to-take-on-apprentice-b4d</guid>
      <description>&lt;p&gt;Hi everyone. This isn't the first time I've opened the doors to taking on an apprentice, and I find it to be the most rewarding part of my career. Watching one-by-one as my students got their first job was one of the most thrilling things to see happen in both their lives and mine, and after really figuring out what it takes to get someone job-ready from nothing, I know exactly how to get you there as well.&lt;/p&gt;

&lt;p&gt;In my opinion, everything you need to get a job is out there on the internet. That doesn't make it easy to become a web developer, though. It's just the start.&lt;/p&gt;

&lt;p&gt;Programming is famously difficult to learn. I partly blame how our education system forces us into this "oh no, I'm wrong!" mentality, and that there's some magic "right answer" out there that only "smart" people know and that's why only "smart" people "get it" and you don't.&lt;/p&gt;

&lt;p&gt;That mentality helps no one. Truth is, though, it's difficult to learn even with the right mentality. It's death-by-a-thousand-choices out there when it comes to learning anything. It's also a lot of uncertainty. How do you know if you're doing anything right, or even useful?&lt;/p&gt;

&lt;p&gt;Well I've seen a pizza boy with no college degree grow into a competent developer with a job by sheer force of will and a light touch of guidance, and I can show you how to do the exact same thing.&lt;/p&gt;

&lt;p&gt;To do this, I'm going to host a small group video chat and Q&amp;amp;A session. Everyone from any background and a desire to get a job in programming is welcome to attend. &lt;/p&gt;

&lt;p&gt;You'll walk away from it knowing exactly what you need to do next to get closer to a job as a web developer. For some of you, that might mean joining my apprenticeship group (and I'll tell you what the group is like during the call). For others, it might mean joining my discord group where we work on small projects to nail the foundations of HTML, CSS, and JS in preparation for professional web app development.&lt;/p&gt;

&lt;p&gt;If you want to join, just reach out to me on either Discord at jk#8880, &lt;a href="https://www.linkedin.com/in/jaykoontz/"&gt;LinkedIn&lt;/a&gt;, or &lt;a href="https://www.reddit.com/user/compacct27"&gt;Reddit&lt;/a&gt; with your current history with learning programming and any questions you'd want answered during the group video call. I'll record it, so don't worry if you can't make it.&lt;/p&gt;

&lt;p&gt;I hope to bring to you my full experience of getting people their first job in this field. If that's what you're looking for, I'm excited to take you there myself.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to turn any design into HTML &amp; CSS</title>
      <dc:creator>Jay Koontz</dc:creator>
      <pubDate>Tue, 28 Sep 2021 19:48:52 +0000</pubDate>
      <link>https://dev.to/jkoontz/how-to-turn-any-design-into-html-css-3j75</link>
      <guid>https://dev.to/jkoontz/how-to-turn-any-design-into-html-css-3j75</guid>
      <description>&lt;p&gt;Online courses hide the most important part of web dev: what to do when it’s just you, an idea, and your IDE.  Todo-list-sized projects are fine, but anything more complicated? It can be overwhelming.&lt;/p&gt;

&lt;p&gt;One of the surprisingly hardest parts is HTML. Not the syntax of it, but how to effectively create a UI for your idea.&lt;/p&gt;

&lt;p&gt;I learned a technique early on that will take a design and turn it into a near-perfect HTML skeleton for your app. &lt;/p&gt;

&lt;h3&gt;
  
  
  Pen and paper to the rescue
&lt;/h3&gt;

&lt;p&gt;The approach is very visual. I use pen and paper in real life, but use an iPad here to record the screen: &lt;br&gt;
&lt;iframe src="https://player.vimeo.com/video/617218454" width="710" height="399"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  How can we use this approach for our own apps when we don't have a design?
&lt;/h3&gt;

&lt;p&gt;Feel free to reach out to me if you get stuck on this part.&lt;/p&gt;

&lt;p&gt;To come up with a prototype design, list out the features you want for your app. Then, scratch out a design with pen and paper until all the features are covered by your prototype. &lt;/p&gt;

&lt;p&gt;Once you have it down, use the same method shown in the video to come up with the HTML skeleton.&lt;/p&gt;

&lt;h3&gt;
  
  
  ...but it doesn't look pretty?
&lt;/h3&gt;

&lt;p&gt;Steal the aesthetics! Don’t use it for commercial gain, but find a design you like and just borrow it. Discord has a nice dark-theme design, AirBnB makes great use of white space for a professional feel, search &lt;a href="https://dribbble.com/shots/popular/product-design"&gt;Dribbble&lt;/a&gt; for user-submitted design inspiration, &lt;a href="https://themes.getbootstrap.com/"&gt;Bootstrap released some nice themes&lt;/a&gt;, and maybe even look into &lt;a href="%E2%80%8B%E2%80%8Bhttps://tailwindcss.com/"&gt;Tailwind&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Aesthetic can be a big draw, but the most important part when building out practice projects is nailing the functionality. Design skills slowly seep in over time. Thankfully, design ain't our job anyways!&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Which projects to build to get a web development job </title>
      <dc:creator>Jay Koontz</dc:creator>
      <pubDate>Thu, 09 Sep 2021 14:47:17 +0000</pubDate>
      <link>https://dev.to/jkoontz/which-projects-to-build-to-get-a-web-development-job-in-2021-59bn</link>
      <guid>https://dev.to/jkoontz/which-projects-to-build-to-get-a-web-development-job-in-2021-59bn</guid>
      <description>&lt;p&gt;Employers want to see that you’ve been-there, done-that with web development. However, most people dive into this journey by having their hand held through an online course. &lt;/p&gt;

&lt;p&gt;When it comes time to actually create something of their own, their head draws a blank, their keyboard stay silent, and they begin to wonder what those courses even taught.&lt;/p&gt;

&lt;p&gt;I’m going to show you which projects will not only get you a job, but teach you how to do web development in the first place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why listen to me?
&lt;/h2&gt;

&lt;p&gt;I had to claw my way into this field. I didn't have a computer science degree, so instead of getting interviews the easy way, I built projects to show I had what it takes. These projects took me to Silicon Valley and San Francisco's tech scene, starting from very little and eventually reaching Senior.&lt;/p&gt;

&lt;p&gt;Since that time, I’ve mentored people into getting their first job in web development using the exact same path I took. The ones who made it did so while holding down full-time jobs or whose background topped out at "pizza delivery driver". &lt;/p&gt;

&lt;p&gt;I had them build projects that got them interviews. Not a degree, not some certificate from LinkedIn, and not even a fancy portfolio website. Just building projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  So which projects get you the job?
&lt;/h2&gt;

&lt;p&gt;That’s a trick question. If you’re asking it, I need to walk you through a mindset shift: projects are the main way you should be learning. It’s not just about showing off your skills, it’s also about building your skills up in the first place.&lt;/p&gt;

&lt;p&gt;Think of things this way: the projects you take on should guide you through the learning process.&lt;/p&gt;

&lt;p&gt;Your first project or two won’t be some super impressive AirBnB clone or fully-featured social network. They will, however, teach you the fundamentals necessary to build such projects.&lt;/p&gt;

&lt;p&gt;Once built, you move on to the harder projects.&lt;/p&gt;

&lt;p&gt;Here’s a better question to ask:&lt;/p&gt;

&lt;h2&gt;
  
  
  What kind of projects turn you into a web developer?
&lt;/h2&gt;

&lt;p&gt;Much better. For this, we start small and work our way up. &lt;/p&gt;

&lt;p&gt;Once you’re familiar with (not an expert in!) HTML, CSS, and JavaScript, you need a project that covers following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Building a UI that will call an API&lt;/li&gt;
&lt;li&gt;Building a server to provide an API for this UI&lt;/li&gt;
&lt;li&gt;Building a database for your server&lt;/li&gt;
&lt;li&gt;Deploying it all on Heroku or AWS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s it for your first project. Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repeat the process with a frontend framework&lt;/li&gt;
&lt;li&gt;Repeat again, but with user authentication&lt;/li&gt;
&lt;li&gt;Repeat again, but for real-world usage through friends or freelancing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No one is ever fully “ready” for building a project when starting out. You're going to hit a number of walls. Thing is, if you don't hit a wall at least a few times a day, you're playing it too safe. &lt;/p&gt;

&lt;p&gt;Venture out, Google what you don't know, and don't judge your coding abilities until you've actually built a few projects. &lt;/p&gt;

&lt;p&gt;Once you’ve worked all the way up to building a real-world app with authentication on a tech stack that companies hire for, you’ve proven to the world that you’re a web developer. Employers will interview you with the right 4 projects under your belt. The plan is simple, but the process is hard.&lt;/p&gt;

&lt;h2&gt;
  
  
  So where do I learn how to do this?
&lt;/h2&gt;

&lt;p&gt;I mean it: &lt;a href="https://dev.to/jkoontz/learn-how-web-apps-work-by-building-one-in-lightning-speed-34km"&gt;dive right into making a project&lt;/a&gt;. Now. Get confused along the way? Google, Google, Google.&lt;/p&gt;

&lt;p&gt;These resources are helpful as well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Odin Project has a &lt;a href="https://www.theodinproject.com/paths/foundations/courses/foundations"&gt;wonderful foundations overview&lt;/a&gt; if JavaScript, HTML, or CSS syntax is an issue. &lt;/li&gt;
&lt;li&gt;Udemy has courses on sale for ~$14, find the highest-rated ones that cover your current needs. Use Google to fill in the holes. &lt;/li&gt;
&lt;li&gt;YouTube has highly-rated, highly-watched videos that cover building servers or databases or whatever you’re stuck on. Just be sure to only take them  because you’ve hit a wall while coding your project. &lt;/li&gt;
&lt;li&gt;If you're stuck on syntax, javascript.info typically has a thorough explanation for you&lt;/li&gt;
&lt;li&gt;Seriously, Google. 7 years in and Google is my most-used tool&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Heads up: there’s no one way to write code either, so code until it works. You’ll learn how to clean things up later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't want to do this alone?
&lt;/h2&gt;

&lt;p&gt;I’ve set up a free Discord group for this process. I take my members through a series of challenges that guides you through each of these topics. I also live stream weekly Q&amp;amp;A sessions on Twitch to help along the way. &lt;a href="https://discord.gg/mGrwDGwyXE"&gt;Join the Discord here to get started&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have any questions about becoming a developer? Really, what else is there to know? Jump into building a project. Hop on that live stream if you have deeper questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  But wait, what are some good project ideas?
&lt;/h2&gt;

&lt;p&gt;The important part here is covering the topics lightly at first and more thoroughly the next time around. Here are some examples:&lt;/p&gt;

&lt;h3&gt;
  
  
  1st project:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://discord.gg/mGrwDGwyXE"&gt;Go through each of these challenges to build a UI from scratch, build a server, and connect it to a database&lt;/a&gt;&lt;br&gt;
Try out a simple, non-realtime chat app with anonymous users (as in, no login)&lt;/p&gt;

&lt;h3&gt;
  
  
  2nd project:
&lt;/h3&gt;

&lt;p&gt;Rebuild the UI for the prior project in React&lt;br&gt;
Build an app that can store and search through your favorite movies, restaurants, or music &lt;/p&gt;

&lt;h3&gt;
  
  
  3rd project:
&lt;/h3&gt;

&lt;p&gt;Create a message board with user login&lt;br&gt;
AirBnB for X. Get silly, like AirBnB for yachts or space ships or puppies. Focus as much energy on the user experience for uploading space ships as you do searching for space ships.&lt;/p&gt;

&lt;h3&gt;
  
  
  4th project:
&lt;/h3&gt;

&lt;p&gt;Message board for your friends&lt;br&gt;
Trip planner for groups (and plan a real trip with it!)&lt;br&gt;
Have a job? Find out if you can build a project to help your team.&lt;/p&gt;

&lt;p&gt;Your real-world project will set you apart from others in your job search. It’ll also be your hardest project. The real world is difficult.&lt;/p&gt;

&lt;p&gt;Building projects is difficult in general--you don’t have to do it alone. Find a group or reach out if you need some help. Good luck!&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Learn how web apps work by building one in lightning speed</title>
      <dc:creator>Jay Koontz</dc:creator>
      <pubDate>Thu, 02 Sep 2021 17:36:02 +0000</pubDate>
      <link>https://dev.to/jkoontz/learn-how-web-apps-work-by-building-one-in-lightning-speed-34km</link>
      <guid>https://dev.to/jkoontz/learn-how-web-apps-work-by-building-one-in-lightning-speed-34km</guid>
      <description>&lt;p&gt;There’s a lot to be gained by deeply studying javascript syntax, how HTML &amp;amp; CSS works, etc, but at the end of the day--we’re here to build. You might not need as much JavaScript as you think to hit the ground running. In fact, you can learn as you go along, just like developers do in the real world.&lt;/p&gt;

&lt;p&gt;We’re going to go all-out here and build a simple non-realtime chat app in native JavaScript with a REST API for the backend using Express.js. We’ll even build a quick database for it in PostgreSQL. By the end of this, you’ll see how everything comes together. You might not understand it perfectly, but that’s okay. Instead of getting stuck in tutorial hell, you’re going to use what you don’t understand to fuel your studies.&lt;/p&gt;

&lt;p&gt;We’re not here to build a beautiful UI, or even a beautiful codebase. Just a simple UI and a quick backend to show off the concepts. &lt;/p&gt;

&lt;p&gt;At the very end, I’ll tie in what you’ve done to how webapp development works in the real world.&lt;/p&gt;

&lt;p&gt;I recommend using &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;VS Code&lt;/a&gt; to browse and edit the codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Warning: you’re about to be thrown in the deep end.
&lt;/h2&gt;

&lt;p&gt;Don’t give up! In fact, move on if you’ve hit too big of a wall. But also, if you haven’t even touched HTML or JavaScript yet, check out &lt;a href="https://www.theodinproject.com/paths/foundations/courses/foundations" rel="noopener noreferrer"&gt;The Odin Project’s foundations course&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How quickly can we build a server?
&lt;/h2&gt;

&lt;p&gt;Very. Building the foundation for a server is usually done once, so we have some tools that can generate a good one for us. My personal favorite is provided by the Express team itself: &lt;a href="https://expressjs.com/en/starter/generator.html" rel="noopener noreferrer"&gt;https://expressjs.com/en/starter/generator.html&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Create a folder for your project, open your terminal or command line to it, and run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx express-generator --no-view
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type in &lt;code&gt;y&lt;/code&gt; if prompted to install.&lt;/p&gt;

&lt;p&gt;Then, run &lt;code&gt;npm i&lt;/code&gt; to install the packages that allow the server to run.&lt;/p&gt;

&lt;p&gt;The terminal will tell you the command to run the app. Copy/paste it to run the server.&lt;br&gt;
Should look something like this: &lt;code&gt;DEBUG=your-project:* npm start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s it. Does it say Listening on port 3000? Whatever port it’s listening on, visit your browser at &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;localhost:3000&lt;/a&gt; (or your specific port).&lt;/p&gt;

&lt;p&gt;Do you see the page? Welcome to Express!&lt;/p&gt;
&lt;h2&gt;
  
  
  But what’s going on inside? Where did that page come from?
&lt;/h2&gt;

&lt;p&gt;Check your app.js file in VS Code. There’s a line that looks like this, go ahead and find it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;static&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;public&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes Express serve the &lt;code&gt;/public&lt;/code&gt; folder in your codebase. You could’ve named it anything so long as it matched with a real directory in your codebase.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/public&lt;/code&gt; contains the HTML, CSS, and (soon!) the JavaScript for your app. &lt;/p&gt;

&lt;p&gt;Go ahead and check out &lt;code&gt;/public/index.html&lt;/code&gt;. It’s fairly straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
         &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Express&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
         &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/stylesheets/style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
         &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Express&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
         &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Welcome to Express&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s where the page came from. This &lt;code&gt;index.html&lt;/code&gt; file is the basis of your UI. You can change it into whatever you want.&lt;/p&gt;

&lt;p&gt;Let’s turn it into a chat app!&lt;/p&gt;

&lt;h2&gt;
  
  
  Building a form that submits chats to the server
&lt;/h2&gt;

&lt;p&gt;Keep it simple--we’re going fast here! We’ll use id’s so JS has something to work with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"chatbox"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Message
       &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"message"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Send&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So how can JS work with it? Create an &lt;code&gt;index.js&lt;/code&gt; file in the &lt;code&gt;/javascripts&lt;/code&gt; folder and put the following code in it--annotated in case you need to dive more deeply into the syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setEventListeners&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nb"&gt;document&lt;/span&gt;
   &lt;span class="c1"&gt;// querySelector uses CSS selectors to get elements. # is for ID's&lt;/span&gt;
   &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#chatbox&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="c1"&gt;// #chatbox is a form, we listen to its "submit" event here&lt;/span&gt;
   &lt;span class="c1"&gt;// Google "addEventListener js" if you'd like to learn more&lt;/span&gt;
   &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;submit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// keeps the page from refreshing&lt;/span&gt;

     &lt;span class="c1"&gt;// "value" is a property all inputs have in a form. for "text" inputs, it's the text&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

     &lt;span class="c1"&gt;// learn about fetch() here: https://javascript.info/fetch&lt;/span&gt;
     &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/chats&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  &lt;span class="c1"&gt;// we'll have to create a /chats route in the server&lt;/span&gt;
       &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Headers&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="c1"&gt;// important!! we want to send things as JSON&lt;/span&gt;
       &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;post&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Google 'HTTP verbs' for more, you'll see it in the server&lt;/span&gt;
       &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="c1"&gt;// turns the JSON into a string for the server to parse&lt;/span&gt;
     &lt;span class="p"&gt;})&lt;/span&gt;
       &lt;span class="c1"&gt;// fetch creates a promise. We chain .then after it for when the fetch is finished&lt;/span&gt;
       &lt;span class="c1"&gt;// Google "promises js" to learn more&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="c1"&gt;// clear it after using that same value property!&lt;/span&gt;
         &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
       &lt;span class="p"&gt;});&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// the HTML needs to load before we can grab any element by ID!&lt;/span&gt;
&lt;span class="c1"&gt;// this will call the setEventListeners function above when DOMContentLoaded occurs&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DOMContentLoaded&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setEventListeners&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If anything in that JS file doesn’t make sense after reading the comments, Google it or use javascript.info to learn more.&lt;/p&gt;

&lt;p&gt;We can’t forget to include this script in our index.html file.&lt;br&gt;
Here’s how your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section in index.html should look for this to work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Express&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/stylesheets/style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"javascripts/index.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What do we do with the server?
&lt;/h2&gt;

&lt;p&gt;We need a way to receive POST requests at the /chats route to match with our fetch call. The body will have a JSON object { message: ‘this is the chat’ }, so we need to take that message and store it. Ideally, we want to do this inside 15 minutes. We’re just storing a message! Nothing fancy at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real quick--what’s a route?
&lt;/h3&gt;

&lt;p&gt;Routes handle the GETs, POSTs, and basically any incoming communication to the server. &lt;br&gt;
Take a look at that /routes folder. We’ve been given index.js and users.js, but if we check out the route in users.js...it’s not that different from index.js:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/routes/users.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* GET users listing. */&lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;respond with a resource&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/routes/index.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* GET home page. */&lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ignore the res.render vs res.send. We see router.get(‘/’ …) for both of them. Wouldn’t they route to the same thing? Shouldn’t the Users route at least say ‘/users’?&lt;/p&gt;

&lt;p&gt;Check out how these routes are actually hooked up to the server in &lt;code&gt;/app.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;indexRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./routes/index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;usersRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./routes/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;indexRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;usersRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There we go. They’re imported using require and then app.use sets the root path for the route. usersRouter gets ‘/users’, and so any fetch made to the ‘/users’ path goes through it.&lt;/p&gt;

&lt;p&gt;Our server needs a ‘/chats’ route, so let’s set that up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Route setup
&lt;/h2&gt;

&lt;p&gt;First, we need a &lt;code&gt;/routes/chats.js&lt;/code&gt; route file. Add that under the routes folder and add this to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// destructuring used here, it's the same as req.body.message&lt;/span&gt;
 &lt;span class="c1"&gt;// Google the concept, it's convenient!&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Router.post? Yep. I’ll explain POST vs GET in more depth soon. In the meantime, notice how our fetch call in the index.js file used a “post” method. These must match for the server to know what to do.&lt;/p&gt;

&lt;p&gt;Once the route is reached, we grab the message from the request body using destructuring (&lt;a href="https://javascript.info/destructuring-assignment" rel="noopener noreferrer"&gt;check out javascript.info for more on destructuring&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;res.sendStatus(200) will send an HTTP 200 status code back to our original fetch request once it’s complete. That means everything turned out fine. You may have heard of the “404” error by now--it means a resource wasn’t found. There are other errors like 500--which means the server is broken. Status messages help the client know whether a request failed, worked just fine, didn’t exist, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But wait, the route isn’t ready to use yet!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's hook up this route first. In app.js, import this file the same way we imported the other routes. I’ll add it to that area so you see what I mean:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;indexRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./routes/index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;usersRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./routes/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;chatsRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./routes/chats&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;indexRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;usersRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/chats&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;chatsRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can use that form and see that the route works. Refresh your server (turn it off and then on again with ctrl+c and then the start command!) and send a message.&lt;/p&gt;

&lt;p&gt;You should see this on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;the chat message you sent]
POST /chats 200 3.424 ms - 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See that 200? Same status that we sent. If the message shows up too, you’re all set. Great work. We’ll send something back to the client once we’ve stored data in our database.&lt;/p&gt;

&lt;h2&gt;
  
  
  So how do we store this message?
&lt;/h2&gt;

&lt;p&gt;Setting up a PostgreSQL database isn’t that much work, and it’s one of those things that takes no prior knowledge to do. The hardest part is usually trying to remember your admin account’s username and password, so write it down somewhere--it’s just for personal use anyways.&lt;/p&gt;

&lt;p&gt;A little bit of context to help:&lt;br&gt;
The server connects to the database. It doesn’t run the database itself. We’re setting up something that runs entirely outside of Express.&lt;/p&gt;

&lt;p&gt;Install PostgreSQL here: &lt;a href="https://www.postgresql.org/download/" rel="noopener noreferrer"&gt;https://www.postgresql.org/download/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will come with a program called pgAdmin, which provides a UI to manage your databases. It’s very handy, so open it up once it’s all ready.&lt;/p&gt;

&lt;p&gt;You’ll need to create a database using the UI. Here’s a screenshot of what to click on:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5j9yddiwak2h4qft16j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5j9yddiwak2h4qft16j.png" alt="Creating a database in pgAdmin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give the database a useful name like “chat-app” and hit save:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxykoxz961d636ubcpgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxykoxz961d636ubcpgb.png" alt="Give the database a name"&gt;&lt;/a&gt;&lt;br&gt;
And boom--your first database. Not so bad, right?&lt;/p&gt;

&lt;p&gt;Now let’s hook it up to our Express app.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sequelize and storing our database password somewhere safe
&lt;/h2&gt;

&lt;p&gt;First off, Express needs credentials to connect to the database. We don’t want those to go public, so we put them in their own file and ensure that file never leaves our computer. &lt;/p&gt;

&lt;p&gt;At the root of your server folder, add a .env file. That’s right, just the extension .env. It’s short for environment, and it’s where we set our environment variables. Database credentials are perfect for this.&lt;/p&gt;

&lt;p&gt;Add the following lines to the .env file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DATABASE=chat-app
DATABASE_USER=[your username, probably postgres]
DATABASE_PASSWORD=[the password you used for the admin account]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to install a few packages for Express to work with our .env file and our database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect to Postgres with Sequelize
&lt;/h2&gt;

&lt;p&gt;We need to install a few packages that help us use our .env file and connect to the database. Run npm i --save dotenv sequelize pg&lt;/p&gt;

&lt;p&gt;Once installed, we’re ready to hook up the database to our Express app. This part isn’t hard from a syntax perspective--it’s just hard to know why we’re doing it and where to put things.&lt;/p&gt;

&lt;p&gt;We have this library called Sequelize that acts as a middleman between Express and our Postgres database. With it, we can connect to the database, create tables, insert and edit data, etc., all with JavaScript syntax.&lt;/p&gt;

&lt;p&gt;I’ll walk you through the setup.&lt;/p&gt;

&lt;p&gt;At the root of your project, create a /models folder and add a db.js file to it. This file will be used to initialize a Sequelize object that can connect to our database. Here’s the contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;Sequelize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sequelize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sequelize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Sequelize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE_USER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;dialect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;postgres&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sequelize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Sequelize&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for some fancy configuration. Go to your /bin/www file. It’s a weird one, but we need to instantiate our env variables and connect to the database here.&lt;/p&gt;

&lt;p&gt;Add the dotenv and db import lines here above the app declaration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
* Module dependencies.
*/&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;dotenv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dotenv&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;dotenv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../models/db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In that same file, we need to use our db import to sync the database before starting our server!&lt;br&gt;
So find the lines in &lt;code&gt;/bin/www&lt;/code&gt; that look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
* Listen on provided port, on all network interfaces.
*/&lt;/span&gt;

&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;listening&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onListening&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;And&lt;/span&gt; &lt;span class="nx"&gt;wrap&lt;/span&gt; &lt;span class="nx"&gt;them&lt;/span&gt; &lt;span class="nx"&gt;like&lt;/span&gt; &lt;span class="nx"&gt;so&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sequelize&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;listening&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onListening&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Okay, can we store chats after all the weird configuration?&lt;/strong&gt;&lt;br&gt;
Not yet! We actually need a chat model for Sequelize to use. The good news is that we’re basically done with DB setup! And, this model will be super simple. Let’s code it and hook it up to our Sequelize instance.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a Sequelize model
&lt;/h2&gt;

&lt;p&gt;Add a file called ‘chat-model.js’ to the /models folder.&lt;br&gt;
We’re going to define our model in it with just a message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ChatModel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sequelize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;DataTypes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sequelize&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;chat&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;{&lt;/span&gt;
           &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;DataTypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;STRING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
               &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
           &lt;span class="p"&gt;}&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;)&lt;/span&gt;

   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I highly recommend reading the docs for Sequelize to familiarize yourself with this code: &lt;a href="https://sequelize.org/v5/manual/getting-started.html" rel="noopener noreferrer"&gt;https://sequelize.org/v5/manual/getting-started.html&lt;/a&gt;. Don’t worry if it doesn’t all make sense at first. It may take a few readings for the concepts to sink in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hooking up our Chat model to our Database
&lt;/h2&gt;

&lt;p&gt;We need to go back to our db.js file, import our Chat model, instantiate it, and export it. &lt;/p&gt;

&lt;p&gt;In the end, db.js will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;Sequelize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sequelize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ChatModel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./chat-model&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;ChatModel&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sequelize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Sequelize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE_USER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;dialect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;postgres&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sequelize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Sequelize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sequelize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Sequelize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Let’s save those chat messages!
&lt;/h2&gt;

&lt;p&gt;Go right back to your &lt;code&gt;/routes/chats.js&lt;/code&gt; file. We’re going to use this Chat export to save our messages.&lt;/p&gt;

&lt;p&gt;First, we need to import it with require. Add this line at the top:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../models/db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;Chat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We’re going to add a line that uses Chat to create that message as a row in our chat database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// destructuring used here, it's the same as req.body.message&lt;/span&gt;
 &lt;span class="c1"&gt;// Google the concept, it's convenient!&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="nx"&gt;Chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
     &lt;span class="nx"&gt;message&lt;/span&gt;
 &lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See &lt;code&gt;Chat.create()&lt;/code&gt;? That’s all it takes! Make sure it’s added as an object. The syntax sugar &lt;code&gt;.create({ message })&lt;/code&gt; is the same as writing &lt;code&gt;.create({ message: message })&lt;/code&gt;. See this article from javascript.info to learn more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ready for the magic?
&lt;/h2&gt;

&lt;p&gt;Alright, reset your server. If you did the setup right, there may have been some extra logs on your terminal during the starting phase. If there was an error instead, read it--it’s very likely related to one of the steps above.&lt;/p&gt;

&lt;p&gt;If all is well, send a message through your UI! It will save in the newly-created database table.&lt;/p&gt;

&lt;p&gt;You can check by opening pgAdmin, clicking into chat-app, clicking into Schemas -&amp;gt; public -&amp;gt; Tables, and right clicking on the ‘chats’ table. Select View/Edit Data -&amp;gt; All Rows:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa4k8rb78ski4ag5x2flt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa4k8rb78ski4ag5x2flt.png" alt="Get all rows in pgAdmin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did you see your message come up? Incredible, right? Sequelize also added an id, createdAt and updatedAt column for you and populated it on its own. Very convenient.&lt;/p&gt;
&lt;h2&gt;
  
  
  Finally, get and display all the chats
&lt;/h2&gt;

&lt;p&gt;This last step makes use of everything we’ve learned so far. We’re going to grab all the chats from the database and display them in our chat app both on load and after everytime we send a chat. You might have noticed that this is not sufficient for a real-time chat app, and you’re right. It’s not. But websockets are super advanced, so we’ll just have to refresh the page or send a message to see any new ones.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a route that grabs all the messages
&lt;/h2&gt;

&lt;p&gt;Sequelize has some handy query methods to make this easy for us. Read more about them here if you’d like: &lt;a href="https://sequelize.org/v5/manual/getting-started.html#querying" rel="noopener noreferrer"&gt;https://sequelize.org/v5/manual/getting-started.html#querying&lt;/a&gt;&lt;br&gt;
We’re going to use &lt;code&gt;Chat.findAll()&lt;/code&gt; for our needs. &lt;/p&gt;

&lt;p&gt;Add this route to &lt;code&gt;/routes/chats.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findAll&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;chats&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the async/await syntax! It’s clean and allows Chat.findAll() to finish before program execution continues. Learn more about it here: &lt;a href="https://javascript.info/async-await" rel="noopener noreferrer"&gt;https://javascript.info/async-await&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the data and display it in the UI
&lt;/h2&gt;

&lt;p&gt;We’re here. One last hard part. We need to both call this route from the UI using fetch and dynamically render the results. ..how do we do that?&lt;/p&gt;

&lt;p&gt;All in the JavaScript! Open the &lt;code&gt;/public/javascripts/index.js&lt;/code&gt; file. We’re going to create a couple functions to make this happen for us.&lt;/p&gt;

&lt;p&gt;The first one will use fetch to grab the data from the server.&lt;br&gt;
The next will render the messages.&lt;/p&gt;

&lt;p&gt;The syntax is a little funky for grabbing the messages, check it out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getMessages&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/chats&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;get&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetchResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s asynchronous, it uses fetch, and looks clean. The hardest part is remembering to call &lt;code&gt;response.json()&lt;/code&gt; like we do above, followed by grabbing what we want off the response. You may think the response is just the messages, but it isn’t! There’s extra data in a response, check it out by using console.log on the response.&lt;/p&gt;

&lt;p&gt;Alright, so what’s the function to render it?&lt;/p&gt;

&lt;p&gt;Well first, let’s add a &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; to our &lt;code&gt;/public/index.html&lt;/code&gt; file with an ID so we can access it easily:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt; &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"messages"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I put it right below the form. Put it wherever you like.&lt;/p&gt;

&lt;p&gt;Now let’s return to &lt;code&gt;index.js&lt;/code&gt; and create a function that renders the messages in that &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; element:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#messages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;listItems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messageObject&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;messageObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/li&amp;gt;`&lt;/span&gt;
   &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

   &lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;listItems&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We used map to loop through all the messages and template literals to cleanly insert the message into the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; tag. Map returns an array, so we use &lt;code&gt;.join(‘’)&lt;/code&gt; to create a single string from the array. Then, we set the &lt;code&gt;innerHTML&lt;/code&gt; of the &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; to the string we created.&lt;/p&gt;

&lt;p&gt;If that sounded Greek to you, I did that on purpose so you would read up on all these topics here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://javascript.info/array-methods#transform-an-array" rel="noopener noreferrer"&gt;Using map to loop through an array and return a new one&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://javascript.info/array-methods#split-and-join" rel="noopener noreferrer"&gt;Using .join() to combine an array's elements into a single string&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://javascript.info/basic-dom-node-properties#innerhtml-the-contents" rel="noopener noreferrer"&gt;Dynamically modifying HTML with JavaScript using .innerHTML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://javascript.info/string#quotes" rel="noopener noreferrer"&gt;Template literals using the &lt;code&gt;backticks with a ${variable}&lt;/code&gt; syntax&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using these functions on init and message send
&lt;/h2&gt;

&lt;p&gt;We’ve got all we need, but now we need to do more on initialization than just set some event listeners. For a project of this size, we can store all the necessary steps in an init() function like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nf"&gt;setEventListeners&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getMessages&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="nf"&gt;renderMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// the HTML needs to load before we can grab any element by ID!&lt;/span&gt;
&lt;span class="c1"&gt;// this will call the setEventListeners function above when DOMContentLoaded occurs&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DOMContentLoaded&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure to update the &lt;code&gt;DOMContentLoaded&lt;/code&gt; listener to call init instead!&lt;/p&gt;

&lt;p&gt;So what should we do on message send? We actually want to grab all the messages from the server and display them. That might sound inefficient, but for this app, we’ll be completely fine.&lt;/p&gt;

&lt;p&gt;Remember where we cleared the value of the message input? Turn that function async by adding &lt;code&gt;async&lt;/code&gt; before &lt;code&gt;function()&lt;/code&gt; and then add the same &lt;code&gt;await getMessages()&lt;/code&gt; and &lt;code&gt;renderMessages&lt;/code&gt; lines here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// clear it after using that same value property!&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getMessages&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nf"&gt;renderMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The final index.js source
&lt;/h2&gt;

&lt;p&gt;I know it’s hard to follow along and find out where to put all that code. Here’s my final output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setEventListeners&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nb"&gt;document&lt;/span&gt;
   &lt;span class="c1"&gt;// querySelector uses CSS selectors to get elements. # is for ID's&lt;/span&gt;
   &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#chatbox&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="c1"&gt;// #chatbox is a form, which has the "submit" listener for when that button is pressed&lt;/span&gt;
   &lt;span class="c1"&gt;// Google "addEventListener js" if you'd like to learn more&lt;/span&gt;
   &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;submit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// keeps the page from refreshing!&lt;/span&gt;

     &lt;span class="c1"&gt;// "value" is a property all inputs have in a form. for "text" inputs, it's the text&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

     &lt;span class="c1"&gt;// fetch is a nice upgrade from XMLHTTPRequest. but..what's this /chat route?&lt;/span&gt;
     &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/chats&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// we'll have to create the /chats route before our server knows what to do with this&lt;/span&gt;
       &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;post&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Google this!&lt;/span&gt;
       &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Headers&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="c1"&gt;// important!! we want to send things as JSON&lt;/span&gt;
       &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="c1"&gt;// turns the JSON into a string for the server to parse&lt;/span&gt;
     &lt;span class="p"&gt;})&lt;/span&gt;
       &lt;span class="c1"&gt;// fetch creates a promise. We chain .then after it for when the fetch is finished&lt;/span&gt;
       &lt;span class="c1"&gt;// Google "promises js" to learn more&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="c1"&gt;// clear it after using that same value property!&lt;/span&gt;
         &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

         &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getMessages&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
         &lt;span class="nf"&gt;renderMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;});&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getMessages&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/chats&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;get&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetchResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#messages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;listItems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt;
   &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/li&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;})&lt;/span&gt;
   &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

 &lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;listItems&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nf"&gt;setEventListeners&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getMessages&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
 &lt;span class="nf"&gt;renderMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// the HTML needs to load before we can grab any element by ID!&lt;/span&gt;
&lt;span class="c1"&gt;// this will call the setEventListeners function above when DOMContentLoaded occurs&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DOMContentLoaded&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  You did it!!
&lt;/h2&gt;

&lt;p&gt;That’s a full client/server web app you’ve created! Is the UI pretty? No. Is it the best coding architecture? It’s not. But it works, and you can build off what you’ve learned here to create bigger projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  ...wait, what did I do?
&lt;/h2&gt;

&lt;p&gt;Now that you’ve set up a client and server, let’s fill in the holes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How client/server architectures work &lt;/li&gt;
&lt;li&gt;How HTTP lets use communicate between our UI and our server&lt;/li&gt;
&lt;li&gt;How Databases work&lt;/li&gt;
&lt;li&gt;“I felt so lost reading this” and why that’s not because you’re dumb&lt;/li&gt;
&lt;li&gt;What’s next?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How client/server architectures work &amp;amp; different ways of hosting HTML
&lt;/h2&gt;

&lt;p&gt;The relationship we set up looks like this:&lt;br&gt;
[client &amp;lt;-&amp;gt; server &amp;lt;-&amp;gt; database]&lt;br&gt;
It’s not the only way to do things. We created a Single Page App. &lt;/p&gt;

&lt;p&gt;Another way to get around it is to not have the server serve the static assets at all and use something else to serve your HTML. &lt;/p&gt;

&lt;p&gt;The server allowed for index.html to be accessed at the root level, localhost:3000. &lt;/p&gt;

&lt;h2&gt;
  
  
  How HTTP lets use communicate between our UI and our server
&lt;/h2&gt;

&lt;p&gt;It’s in the name: Hyper Text Transfer Protocol. HTTP is just text. It’s used to hold so many things, but it’s all text. Servers and browsers standardized what this text says to make it useful for communicating to each other.&lt;/p&gt;

&lt;p&gt;Open up Chrome’s Dev Tools (cmd + option + i for Mac and Shift + CTRL + J  for Windows)&lt;br&gt;
Check out the Network tab and refresh the page. You’ll see all the requests made. Clicking into these requests show a whole world of information: header info, payloads &amp;amp; their sizes, server paths, and even diagnostic info like how long a request took.&lt;/p&gt;

&lt;p&gt;If you visit localhost:3000/chats, you’ll actually see the JSON response for all the chats you can grab when doing a GET call to /chats. So what’s GET? It’s an HTTP verb.&lt;/p&gt;

&lt;p&gt;The browser sends a GET request to that URL every time you use it to visit or refresh a page. We sent one directly with fetch, and the same server route is reached when a browser visits a URL. Browsers send GET requests to any URL you want, it’s how the web works.&lt;/p&gt;

&lt;p&gt;There are other HTTP verbs we can use:&lt;br&gt;
POST, generally used to “create” resources on the server&lt;br&gt;
PUT, generally used to update a resource by providing the entire object to replace it with&lt;br&gt;
PATCH, generally used to update a resource by providing the parts of the resource to update &lt;br&gt;
DELETE, generally used to delete resources&lt;/p&gt;

&lt;p&gt;GET requests have one major difference with POST aside from its responsibility:&lt;br&gt;
With POST requests, you generally provide the resource in the body as an object, like we did above.&lt;br&gt;
With GET requests, if you need to provide extra variables, you do so in the URL itself. You may have seen URLs like “&lt;a href="https://localhost:3000/chats?key=val" rel="noopener noreferrer"&gt;https://localhost:3000/chats?key=val&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These resources dive deeper into this subject:&lt;/p&gt;

&lt;h2&gt;
  
  
  How databases work
&lt;/h2&gt;

&lt;p&gt;The sheer number of databases you could use would make your head spin. There isn’t a single answer to which database to use for your app, and there are more options every year.&lt;/p&gt;

&lt;p&gt;The classics you’ll hear the most about at the beginner level are PostgreSQL, MySQL, and MongoDB. Stick to these and you’ll be fine.&lt;/p&gt;

&lt;p&gt;Postgres and MySQL are relational databases which use SQL to interact with, add to, and edit your stored data. MongoDB falls under “NoSQL” and has its own syntax for database interaction. &lt;/p&gt;

&lt;p&gt;No matter how much flack any one database gets, they’ve all been used to start and run highly successful companies. MongoDB can be a bit quicker to get started with, but you get a bit more respect from the developer community for understanding SQL, the language used to interact with Postgres, MySQL, and other relational databases. Learn more about these topics here:&lt;br&gt;
Youtube, etc&lt;/p&gt;

&lt;h2&gt;
  
  
  “I felt so lost reading this” and why that’s not because you’re dumb
&lt;/h2&gt;

&lt;p&gt;You’re looking at how much you know right now and feel like you’re coming up short. Lots of people do this. Everyone’s confidence, absolutely everyone’s, is humbled by how difficult this field is. Here’s the thing: if you judge yourself on how much you know, you’ll always fall short. Instead, judge yourself on being able to figure things out. &lt;/p&gt;

&lt;p&gt;The unknowns never end. After 7 years in this field, I use Google constantly. Everyone does. It’s the real skill to learn.&lt;/p&gt;

&lt;p&gt;See a topic you want more info on? YouTube it. Google around. Find a relevant online course through Udemy. StackOverflow likely has answers. &lt;/p&gt;

&lt;p&gt;This project is meant to throw you in the deep end. I bet if you did it a 2nd time, it’d go a bit smoother. Do it a 3rd time, and you could probably add to it with ease. &lt;/p&gt;

&lt;p&gt;Learning never stops in this profession. Ever. The beginning of any project is typically research-oriented. I had to have a small refresher myself to make sure I was using fetch correctly. The concepts will come up again and again, but the concept that reigns supreme is how to find things out with the right Google search query.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next?
&lt;/h2&gt;

&lt;p&gt;It’s time to dive deeper into each of these topics: building a UI, building a server, modeling data for your database. Your knowledge of syntax will solidify along the way.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>node</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
