<?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: Edwin Reyes Rodriguez</title>
    <description>The latest articles on DEV Community by Edwin Reyes Rodriguez (@reyesedwin).</description>
    <link>https://dev.to/reyesedwin</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%2F794544%2F39b684fe-9c06-42cf-909b-22148a488c2f.jpeg</url>
      <title>DEV Community: Edwin Reyes Rodriguez</title>
      <link>https://dev.to/reyesedwin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/reyesedwin"/>
    <language>en</language>
    <item>
      <title>Getting Started With Vercel</title>
      <dc:creator>Edwin Reyes Rodriguez</dc:creator>
      <pubDate>Mon, 14 Mar 2022 03:39:47 +0000</pubDate>
      <link>https://dev.to/reyesedwin/getting-started-with-vercel-21i6</link>
      <guid>https://dev.to/reyesedwin/getting-started-with-vercel-21i6</guid>
      <description>&lt;p&gt;Are you sick and tired of configuring your Github pages yet still failing to deploy your project? If you are, I got a solution for you. &lt;/p&gt;

&lt;h2&gt;
  
  
  Vercel
&lt;/h2&gt;

&lt;p&gt;As you know, there is sometimes always a solution to our problems. With Vercel, we can skip the tedious GitHub pages workflow and build and deploy projects faster and more scalable. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n0Jcfsw---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ltkkq76bkx4tplj5kn0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n0Jcfsw---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ltkkq76bkx4tplj5kn0.png" alt="Image description of meme" width="880" height="586"&gt;&lt;/a&gt;&lt;br&gt;
So what is Vercel? &lt;a href="https://vercel.com/docs"&gt;Vercel&lt;/a&gt; is a platform for building front-end frameworks for static sites that developers can integrate with headless content, commerce, or database applications. With their frictionless developer experience, they handle the hard stuff, like deploying, scaling automatically, and providing personalized content worldwide.&lt;/p&gt;

&lt;p&gt;A couple of weeks ago, I struggled to deploy a recent lab to Github pages, and their workflow was just complicated and time-consuming. When I found out about Vercel, I quickly imported the repo and deployed my project faster than I could've ever thought. An excellent user experience, in my opinion.&lt;/p&gt;

&lt;p&gt;So enough chit chatting, let's deploy a project using Vercel. &lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First, &lt;a href="https://vercel.com/signup"&gt;create an account&lt;/a&gt; with Vercel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fork and clone this &lt;a href="https://github.com/btopro/ist-vercel-demo"&gt;repository&lt;/a&gt; onto your local machine. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There is a .env file needed for this to work locally. Create a .env file in the git repo you cloned down locally.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t22KIgHR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zritzbt5eulpgqgc7dgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t22KIgHR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zritzbt5eulpgqgc7dgb.png" alt="Creating a file" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside this file add this content and commit your changes: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Th7FdRfh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbntp9qf77e1th4sv076.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Th7FdRfh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbntp9qf77e1th4sv076.png" alt="Image description of code" width="880" height="525"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your Vercel account create and import your repo. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZJZ0R8RI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73yceb5svciyfh17udnk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZJZ0R8RI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73yceb5svciyfh17udnk.png" alt="Image description of vercel" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Quickly configure your project, override the output directory with &lt;code&gt;dist&lt;/code&gt;, and deploy the project.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p1YaBAFO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytb2wu8ogh39e988v579.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p1YaBAFO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytb2wu8ogh39e988v579.png" alt="Image description of output" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Once you have successfully deployed your project, a confetti animation will display, showing you the Vercel site and link you can access anytime from anywhere. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QNWEt8RI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/082n2weot5qjrh06qtka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QNWEt8RI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/082n2weot5qjrh06qtka.png" alt="Image description of vercel site" width="880" height="525"&gt;&lt;/a&gt;&lt;a href="https://ist-vercel-demo-red.vercel.app/"&gt;View Vercel site&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Thoughts?
&lt;/h2&gt;

&lt;p&gt;There's a big difference when deploying your CI/CD pipeline in Vercel comparing Github. &lt;/p&gt;

&lt;p&gt;I found it very useful and deployed three other recent labs I have accomplished. Please take a look at them and view how effectively Vercel is. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11ty&lt;/strong&gt;&lt;br&gt;
Vercel site: &lt;a href="https://eleventy-seven-orpin.vercel.app/"&gt;https://eleventy-seven-orpin.vercel.app/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RXeWNwek--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqolbtj77tossli77mjz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RXeWNwek--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqolbtj77tossli77mjz.png" alt="Image description of 11ty" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;hello-world-11ty&lt;/strong&gt;&lt;br&gt;
Vercel site: &lt;a href="https://hello-world-11ty.vercel.app/"&gt;https://hello-world-11ty.vercel.app/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O7z6YU8o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtanrwbk6vchar5nm4q2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O7z6YU8o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtanrwbk6vchar5nm4q2.png" alt="Image description of 11ty-hello-world" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11ty template&lt;/strong&gt;&lt;br&gt;
Vercel site: &lt;a href="https://11ty-template.vercel.app/"&gt;https://11ty-template.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KeDfQsEk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2snpo0t5yrmt0rtfggsw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KeDfQsEk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2snpo0t5yrmt0rtfggsw.png" alt="11ty temp" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Now that you have a view and deployed your project with Vercel, I would like to know your thoughts on your overall experience. Would you consider deploying projects in Vercel instead of Github?&lt;/p&gt;

&lt;p&gt;Also, if you're curious, I have been lately learning micro frontend architecture and its benefits. If you would like to learn more about it, please check out this article by Michael Potter on &lt;a href="https://www.redhat.com/architect/micro-frontend-architecture"&gt;How to use micro frontends to architect web apps&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.redhat.com/architect/micro-frontend-architecture"&gt;https://www.redhat.com/architect/micro-frontend-architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vercel.com/docs"&gt;https://vercel.com/docs&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>webdev</category>
      <category>vercel</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Utilizing 11ty To Make Powerful Blogs</title>
      <dc:creator>Edwin Reyes Rodriguez</dc:creator>
      <pubDate>Mon, 28 Feb 2022 03:39:35 +0000</pubDate>
      <link>https://dev.to/reyesedwin/utilizing-11ty-to-make-powerful-blogs-511i</link>
      <guid>https://dev.to/reyesedwin/utilizing-11ty-to-make-powerful-blogs-511i</guid>
      <description>&lt;p&gt;Eleventy is a simpler static site generator. We will be using their template to build three simple blogs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Before getting started, Eleventy v1.0.0 requires Node 12 or newer. Use &lt;code&gt;node --version&lt;/code&gt; on the command line to find your local Node version. If you don't have node, you'll have to install it &lt;a href="https://nodejs.org/en/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To make a simple quick hello-world style blog using 11ty, open up your terminal and run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo '# Page header' &amp;gt; README.md
npx @11ty/eleventy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the code above, your output would be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Writing _site/README/index.html from ./README.md (liquid)
Wrote 1 file in 0.03 seconds (v1.0.0)`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can add content in the &lt;code&gt;README.md&lt;/code&gt;. The power of 11ty would automatically convert your markdown file into raw HTML.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;npx @11ty/eleventy --serve&lt;/code&gt; to start up a web server. Then open &lt;a href="http://localhost:8080/README/"&gt;http://localhost:8080/README/&lt;/a&gt; in your web browser of choice to see your Eleventy output. You can view my example &lt;a href="https://reyes-edwin.github.io/hello-world-11ty/README/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Utilizing Existing 11ty Template
&lt;/h2&gt;

&lt;p&gt;We will be using an existing 11ty template. To get started, first head over to the &lt;a href="https://github.com/11ty/eleventy-base-blog"&gt;repo&lt;/a&gt; and click the "Use this template" button. You can also view my example &lt;a href="https://reyes-edwin.github.io/11ty-template/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next, clone the repository to your local files. Open up your terminal and run &lt;code&gt;git clone (your repo url)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9uda5AuC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0coucmo76gv7ceg3b4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9uda5AuC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0coucmo76gv7ceg3b4s.png" alt="Image description of repo" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can add or remove the content in the 'post' directory. This template comes with pre-generated CSS, but you can modify it in the CSS folder. 11ty would handle the backend and link your post to other blog posts. Here's an example on how to add content. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ru0GqJyi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udurgc2tq5vbedrs3seu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ru0GqJyi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udurgc2tq5vbedrs3seu.png" alt="Image description of code" width="880" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To view your blog, you must first install the required dependencies by running &lt;code&gt;npm install&lt;/code&gt;. Then, run &lt;code&gt;npx eleventy --serve&lt;/code&gt;. Your result should look like this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cHdiCECp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95fpioqbqxx7prpwajah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cHdiCECp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95fpioqbqxx7prpwajah.png" alt="Image description of 11ty blog" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view real-time updates as you modify your blog. To cancel the server, click &lt;code&gt;ctrl + c.&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Another existing template we can utilize would be Hax11ty. This is a pre-generated template by btopro.&lt;/p&gt;

&lt;p&gt;To get started first, head over to the repository and click the "Use this template" button. &lt;/p&gt;

&lt;p&gt;Next, clone the repository to your local files. Open up your terminal and run &lt;code&gt;git clone (your repo URL).&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4tzBOD-x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5eu1trs34fdupg1srbda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4tzBOD-x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5eu1trs34fdupg1srbda.png" alt="Image description of repo" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can add or remove content in the contents folder. Here's an example of mines. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kJhjv0Lg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lk136q9asfgwt9m5hu6r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kJhjv0Lg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lk136q9asfgwt9m5hu6r.png" alt="Image description of code" width="880" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To view your blog, you must first install the required dependencies by running &lt;code&gt;npm install&lt;/code&gt;. Then, run &lt;code&gt;npm start&lt;/code&gt;. Your result would look like this. View my example &lt;a href="https://reyes-edwin.github.io/Hax11ty/content/blogs/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zy5E3RTa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h1lm9etsym3bc4kdexjp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zy5E3RTa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h1lm9etsym3bc4kdexjp.png" alt="Image description of blog" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that your blogs are up and running, you can select the best template to use and add as much desired content as you need. &lt;/p&gt;

&lt;h2&gt;
  
  
  11ty vs Hax11ty
&lt;/h2&gt;

&lt;p&gt;The Hax11ty template is much cleaner and better organized compared to 11ty. Using the 11ty quick started requires more dependencies and a lot of coding to make your site more pleasing. Using a pre-existing template gives you more freedom as you most likely run into less bugs. &lt;/p&gt;




&lt;p&gt;11ty is such a powerful tool allowing you to build quick static sites. You can check out how I did the three blogs above in the links below. &lt;/p&gt;

&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;11ty hello-world: &lt;a href="https://github.com/reyes-edwin/hello-world-11ty"&gt;https://github.com/reyes-edwin/hello-world-11ty&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;11ty template: &lt;a href="https://github.com/reyes-edwin/11ty-template"&gt;https://github.com/reyes-edwin/11ty-template&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;hax11ty template: &lt;a href="https://github.com/reyes-edwin/Hax11ty"&gt;https://github.com/reyes-edwin/Hax11ty&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>11ty</category>
      <category>blogs</category>
    </item>
    <item>
      <title>The Power Of Docker</title>
      <dc:creator>Edwin Reyes Rodriguez</dc:creator>
      <pubDate>Mon, 28 Feb 2022 03:38:49 +0000</pubDate>
      <link>https://dev.to/reyesedwin/the-power-of-docker-4dcb</link>
      <guid>https://dev.to/reyesedwin/the-power-of-docker-4dcb</guid>
      <description>&lt;p&gt;Initially, I had never heard of Docker or even viewed examples of utilizing it. However, I now understand why Docker is so powerful after playing with it a bit.  &lt;/p&gt;

&lt;p&gt;Today I will cover the effectiveness of Docker, getting started with playing with Docker and how to create a Dockerfile. &lt;/p&gt;




&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--11GQ-rCn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f591eqlmfrlht7wqqeh1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--11GQ-rCn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f591eqlmfrlht7wqqeh1.png" alt="Image of Docker logo" width="880" height="302"&gt;&lt;/a&gt;&lt;br&gt;
You might be questioning yourself, "what the hell is Docker?" Trust me, I was there too. &lt;a href="https://docs.docker.com/get-started/overview/"&gt;Docker&lt;/a&gt; is an open-source platform that lets developers build, ship, and run applications. Docker is powerful because it makes it easier for you to separate your applications from your infrastructure, enabling rapid software delivery. &lt;/p&gt;
&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;Docker works by providing a standard way to run your code. Docker is an operating system for &lt;a href="https://docs.docker.com/get-started/overview/#containers"&gt;containers&lt;/a&gt;. Just as virtual machines virtualize (remove the need for direct management) server hardware, containers virtualize the operating systems on servers. Each server has Docker installed and provides simple commands for building, starting, and stopping containers.&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;To get started, head over to the &lt;a href="https://www.docker.com/play-with-docker#101%20Tutorial/#101%20Tutorial"&gt;Docker 101 tutorial&lt;/a&gt; under tutorial. You can either take the tutorial on your desktop or in the cloud. In this example, I would be taking the tutorial in the cloud found &lt;a href="https://labs.play-with-docker.com/"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M2QIerK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h734l5w6ao9f3m6fa8sc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M2QIerK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h734l5w6ao9f3m6fa8sc.png" alt="Image description of docker" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To access their interactive playground, you first need to &lt;a href="https://hub.docker.com/"&gt;create an account&lt;/a&gt;. If you have an account, simply login in using your Docker ID and password.&lt;/p&gt;

&lt;p&gt;Once you log in, you'll see your own Docker VM. To launch Docker's tutorial, you first must create an instance.&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ah7eEfeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cxv71xt6kno9he19tsih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ah7eEfeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cxv71xt6kno9he19tsih.png" alt="Image description of docker" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, in your PWD terminal, write the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -dp 80:80 docker/getting-started:pwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would create a container in port 80. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9VSgJ7Z5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/670dddqc63ip18ylo7mc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9VSgJ7Z5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/670dddqc63ip18ylo7mc.png" alt="Image description of docker" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After successfully running the command, port 80 would display a container containing the Dockers 101 tutorial. Throughout this series, you will learn the commands for Docker while seeing the benefit of why building a microservices infrastructure is better instead of a monolithic one. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v65CvMxe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2mwyoiradcdsdrhg7myc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v65CvMxe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2mwyoiradcdsdrhg7myc.png" alt="Image description of docker" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0ad4ALoV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdkofpgu05ohcw41yhkl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0ad4ALoV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdkofpgu05ohcw41yhkl.png" alt="Image description of tutorial" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations, you have reached all the necessary steps to start with Docker. Now head on over to the tutorial and learn how to utilize Docker in your applications. &lt;/p&gt;




&lt;h2&gt;
  
  
  NASA API
&lt;/h2&gt;

&lt;p&gt;In this sections I would be teaching you how to create a Dockerfile for one of my latest project.  &lt;/p&gt;

&lt;p&gt;To run the NASA API project in Docker, we need to ensure our Docker file has the needed scripts. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In Dockers playground, first, clone our repository and &lt;code&gt;cd&lt;/code&gt; into the folder.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4wczzrWY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8ur4w1mpuc0x58c1d36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4wczzrWY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8ur4w1mpuc0x58c1d36.png" alt="Example of cloning a repo" width="880" height="503"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, we need to create a Docker file. In your PWD type &lt;code&gt;touch Dockerfile&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UFA94aXC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94qaxfdtqxsk0h9p2m3z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UFA94aXC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94qaxfdtqxsk0h9p2m3z.png" alt="Image description of docker" width="880" height="503"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After creating the file, you'll want to open the editor's tab and locate the Dockerfile. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EcPKtGoY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmtf5bs19gafzeuiwbvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EcPKtGoY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmtf5bs19gafzeuiwbvf.png" alt="Image description of docker" width="880" height="503"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Our Docker file needs some scripts to run. In the Dockerfile, enter the following command and save the new changes.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:12

WORKDIR /home/node/app

COPY package.json ./
RUN yarn install

COPY . .

CMD [ "yarn", "start" ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Next, we need to build the container image using the docker build command. &lt;code&gt;docker build -t nasa-image&lt;/code&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fVNILLVU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wzk8186p7rrsa65u56a.png" alt="Image description of pwd" width="880" height="503"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's run the application now that we have an image! To do so, we will use the &lt;code&gt;docker run&lt;/code&gt; command.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;docker run -dp 8000:8000 nasa-image&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After running the command open your local host with the port 8000. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, you should have a running Docker application.  &lt;/p&gt;

&lt;p&gt;As always, thank you for reading, and I hope you have a wonderful day. &lt;/p&gt;

</description>
      <category>docker</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Using The Javascript Fetch API To Get Data</title>
      <dc:creator>Edwin Reyes Rodriguez</dc:creator>
      <pubDate>Mon, 31 Jan 2022 04:13:58 +0000</pubDate>
      <link>https://dev.to/reyesedwin/using-the-javascript-fetch-api-to-get-data-3k55</link>
      <guid>https://dev.to/reyesedwin/using-the-javascript-fetch-api-to-get-data-3k55</guid>
      <description>&lt;p&gt;Today, I'm going to walk you through how to wire up some data up to a Wikipedia-query tag so that when your IP address changes, your location will change, and so will the Wikipedia article. &lt;/p&gt;

&lt;p&gt;You will see something like this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y1EUci0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3e9trrmekdw11750j6cr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y1EUci0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3e9trrmekdw11750j6cr.png" alt="Image of wiki tags" width="880" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;For this lab we utilize &lt;a href="https://freegeoip.app/"&gt;GeoIP&lt;/a&gt; to retrieve our &lt;code&gt;lat&lt;/code&gt;, &lt;code&gt;long&lt;/code&gt;, &lt;code&gt;city&lt;/code&gt;, and &lt;code&gt;state&lt;/code&gt;. Here's how our constructor looks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  constructor() {
    super();
    this.locationEndpoint = 'https://freegeoip.app/json/';
    this.long = null;
    this.lat = null;
    this.city = null;
    this.state = null;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we set the properties that we later use to populate our data. Here we return our lat and long as integers and our city and state as strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  static get properties() {
    return {
      long: { type: Number },
      lat: { type: Number },
      city: { type: String },
      state: { type: String },
    };
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fetching the data
&lt;/h2&gt;

&lt;p&gt;Before fetching the data from our API, let's talk about what &lt;code&gt;fetch&lt;/code&gt; is. Fetch API is an interface that allows you to make HTTP requests to servers from web browsers. We utilize the &lt;code&gt;fetch&lt;/code&gt; to retrieve our location based on our IP address in this lab. See how we utilize fetch in our lab.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  async getGEOIPData() {
    const IPClass = new UserIP();
    const userIPData = await IPClass.updateUserIP();
    return fetch(this.locationEndpoint + userIPData.ip)
      .then(resp =&amp;gt; {
        if (resp.ok) {
          return resp.json();
        }
        return false;
      })
      .then(data =&amp;gt; {
        // console.log(data);
        this.long = data.longitude;
        this.lat = data.latitude;
        this.city = data.city;
        this.state = data.region_name;

        return data;
      });
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code block, using the URL we set to &lt;code&gt;locationEndpoint&lt;/code&gt;  we were able to &lt;code&gt;fetch&lt;/code&gt; our location based on our IP address. We used fetch to make an HTTP request to the server holding the API, then if the response was "ok," we will return the API call as a &lt;a href="https://www.json.org/json-en.html"&gt;JSON&lt;/a&gt;. Here's what the API response should look like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"ip": "102.16.28.100",
"country_code": "US",
"country_name": "United States",
"region_code": "PA",
"region_name": "Pennsylvania",
"city": "State College",
"zip_code": "16802",
"time_zone": "America/New_York",
"latitude": 40,
"longitude": -77,
"metro_code": 574
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We then set our properties &lt;code&gt;lat&lt;/code&gt;, &lt;code&gt;long&lt;/code&gt;, &lt;code&gt;city&lt;/code&gt;, and &lt;code&gt;state&lt;/code&gt; to the variables the API returns to access the data. In this case, we only need the latitude, longitude, city, and region_name, which means the state you are in.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Render()
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;render() {
    // this function runs every time a properties() declared variable changes
    // this means you can make new variables and then bind them this way if you like
    const url = `https://maps.google.com/maps?q=${this.lat},${this.long}&amp;amp;t=&amp;amp;z=15&amp;amp;ie=UTF8&amp;amp;iwloc=&amp;amp;output=embed`;
    return html`&amp;lt;iframe title="Where you are" src="${url}"&amp;gt;&amp;lt;/iframe&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;link href="https://www.google.com/maps/@${this.lat},${this.long},14z" /&amp;gt;
      &amp;lt;wikipedia-query search="${this.city}, ${this.state}"&amp;gt;&amp;lt;/wikipedia-query&amp;gt;
      &amp;lt;wikipedia-query search="${this.city}"&amp;gt;&amp;lt;/wikipedia-query&amp;gt;
      &amp;lt;wikipedia-query search="${this.state}"&amp;gt;&amp;lt;/wikipedia-query&amp;gt; `;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method is invoked on each update to perform rendering tasks. This method returns any value renderable by lit-HTML's elements. We pass the &lt;code&gt;lat&lt;/code&gt; and &lt;code&gt;long&lt;/code&gt; properties to get the Iframe working. Whenever these properties are changed, lit render the information and updates. Here's the results. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f7mE_xRM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4lomcvf66h6xpwf37vm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f7mE_xRM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4lomcvf66h6xpwf37vm.png" alt="Image description of maps" width="860" height="884"&gt;&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Wiring the wikipedia tags
&lt;/h2&gt;

&lt;p&gt;In order to get the wikipedia tag working we first must the following. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create an HTML link that sits below the iframe that links to the location on google maps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pass the &lt;code&gt;lat&lt;/code&gt;, and &lt;code&gt;long&lt;/code&gt; properties. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next run npm &lt;code&gt;install @lrnwebcomponents/wikipedia-query&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In order to use the  we must &lt;code&gt;import&lt;/code&gt; the tag at the top of your file to use it &lt;code&gt;import '@lrnwebcomponents/wikipedia-query/wikipedia-query.js;'&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, in our render function add in the wikipedia tags. &lt;a href="https://en.wikipedia.org/w/api.php"&gt;Wikipedia's API is documented here&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The search property takes&lt;code&gt;${this.city}&lt;/code&gt;, &lt;code&gt;${this.state}&lt;/code&gt; and the comma then a space to ensure the tags work properly. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After following the steps above your results should look like this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iHufuWJj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilerbxvpad40hrsyjica.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iHufuWJj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilerbxvpad40hrsyjica.png" alt="Image description on wiki" width="880" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Based on your location the Wikipedia tag will display information of your state and city. &lt;/p&gt;

&lt;p&gt;Now you have successfully fetch an API to wire Wikipedia tags. Way to go!&lt;/p&gt;

&lt;p&gt;To view the complete project &lt;a href="https://github.com/reyes-edwin/ip-project/blob/master/src/LocationFromIP.js"&gt;click here.&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@lrnwebcomponents/wikipedia-query"&gt;Wikipedia-query&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://freegeoip.app/"&gt;GeoIP&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch"&gt;Fetch API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>How To Build A Basic Web Component</title>
      <dc:creator>Edwin Reyes Rodriguez</dc:creator>
      <pubDate>Sun, 16 Jan 2022 21:48:49 +0000</pubDate>
      <link>https://dev.to/reyesedwin/how-to-build-a-basic-web-component-mjo</link>
      <guid>https://dev.to/reyesedwin/how-to-build-a-basic-web-component-mjo</guid>
      <description>&lt;p&gt;Initially, I only knew three things when I started web development: HTML, CSS, and Js. Now there are hundreds of libraries and frameworks to choose from.  If you're new to web components, you're at the right place. In this tutorial, I will show you how to build a simple web component using the Lit library. &lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;First thing first.... What are web components?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Web Component is a collection of web platform APIs that can be used to create custom, reusable HTML tags that can be used in web pages and web apps. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components"&gt;Learn more&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NpFarjdv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2lv5s7gsfwadn4gm3vme.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NpFarjdv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2lv5s7gsfwadn4gm3vme.gif" alt="A gif of a custom HTML tag" width="880" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Web components are based on existing web standards. The features needed to support web components are currently being implemented to the HTML and DOM specs, allowing developers to extend HTML elements with encapsulated styling and custom behavior. &lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Software Installation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before we get started, you first will need to install some tools. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nodejs.org/en/"&gt;Node.js&lt;/a&gt; is an open-source, cross-platform runtime environment for executing javascript code. Due to its event-driven, non-blocking I/O model, Node.js is lightweight and efficient, making it ideal for data-intensive real-time applications to run across multiple devices. When you also install Node, you install NPM. NPM is a "package manager" that simplifies and speeds up the installation of Node "packages." A package, also called a module, is just a code library that extends Node by adding useful features.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rT_GMG6U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cdvy1eg8mmcec0yp88s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rT_GMG6U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cdvy1eg8mmcec0yp88s.png" alt="Image of the Node.js doc" width="880" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you arrive at the site, you'll want to download the recommended file. To test if node is installed, open up your terminal, type in &lt;code&gt;node&lt;/code&gt; on the command line, and hit enter. A welcome text with the latest version of node should appear.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hHMXBACi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p45e98t7a5l8k6r42d8z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hHMXBACi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p45e98t7a5l8k6r42d8z.png" alt="Image of a terminal" width="880" height="607"&gt;&lt;/a&gt;&lt;br&gt;
If you get a message saying &lt;code&gt;zsh: command not found: node&lt;/code&gt; retry downloading Node again. In case you still have trouble installing Node, please refer to this &lt;a href="https://nodesource.com/blog/installing-nodejs-tutorial-mac-os-x/"&gt;article.&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://classic.yarnpkg.com/en/docs/install#mac-stable"&gt;Yarn&lt;/a&gt; is a package manager for your code, enabling you to share and use (e.g. JavaScript) code with other developers. To install Yarn, open up your terminal and type &lt;code&gt;npm install --global yarn&lt;/code&gt;. Once installed, run &lt;code&gt;yarn -v&lt;/code&gt;, and the latest yarn version should display. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YQaFMcq0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ouboju8k8cvijdi6pbx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YQaFMcq0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ouboju8k8cvijdi6pbx.png" alt="Image description of yarn installation" width="880" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once these tools have been installed successfully, we can begin building our first web component. &lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; - Start by creating an empty folder and naming it what you like. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt; -  Inside the directory you just created run &lt;code&gt;npm init @open-wc&lt;/code&gt;. We will use Open Web Components to get started. You can learn more about it &lt;a href="https://open-wc.org/docs/"&gt;here.&lt;/a&gt; If successful, you should get the same results as me. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R_JFiWjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kehtp35kxod24hwry4g1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R_JFiWjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kehtp35kxod24hwry4g1.png" alt="Image of terminal" width="880" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, you'll want to start a new scaffold project. Simply hover over it and press &lt;code&gt;enter&lt;/code&gt; and select &lt;strong&gt;web component&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CWdjZR2l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1pu5uvajzms6j2aguix.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CWdjZR2l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1pu5uvajzms6j2aguix.png" alt="Image of WC" width="880" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After achieving this, you'll want to select all available options. You can do this by pressing &lt;code&gt;a&lt;/code&gt; and hitting &lt;code&gt;enter.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt; - The next question prompts you if you "would like to use typescript? " We are going to select no. The next step is to give our web component a name. &lt;strong&gt;Note:&lt;/strong&gt; You need a minimum of two lowercase words separated by dashes—for example, &lt;code&gt;hello-world&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7Xd-yW_C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f0ti9uczhk08gs6ybzp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Xd-yW_C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f0ti9uczhk08gs6ybzp.png" alt="Image of disk tree" width="880" height="682"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we will select "yes" for our file structure and install all of our dependencies with &lt;strong&gt;Yarn&lt;/strong&gt;. If you weren't successful installing Yarn, you could use &lt;strong&gt;NPM&lt;/strong&gt; instead. After a few seconds, all of your dependencies should be installed, and a message saying, "You are all set up now!" would display. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--teFxS2j8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ogg9b669ci4ya0vh0g47.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--teFxS2j8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ogg9b669ci4ya0vh0g47.png" alt="Image of yarn install" width="880" height="682"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations!! You have successfully created your first web component. To launch the site, first, you need to make sure you are inside the directory of the web component you just named. You can do this by typing &lt;code&gt;ls&lt;/code&gt; and then &lt;code&gt;cd&lt;/code&gt; into the folder. Once inside the directory, you need to run &lt;code&gt;yarn start&lt;/code&gt; or &lt;code&gt;npm run start&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1j_Xo4nT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3w3kfi6vcalxs6l4qe1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1j_Xo4nT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3w3kfi6vcalxs6l4qe1.png" alt="Image of web server" width="880" height="607"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;A website would launch every time you start your web component. To terminate the application, press &lt;code&gt;[control] + c&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;If you have trouble completing the steps above, I recommend watching this &lt;a href="https://www.youtube.com/watch?v=r_mio0e6v1g"&gt;video&lt;/a&gt; of my professor walking through the installation process.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Next Steps?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that you have created your first web component, I recommend you practice and understand the code under the &lt;code&gt;/src file&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UjBJnh_S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2czglqbdqq9hur17rft0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UjBJnh_S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2czglqbdqq9hur17rft0.png" alt="Image description of source file" width="880" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, you'll notice the import statement at the top of your javascript file. Here we import the HTML, CSS template literal tags that can be used and rendered with Lit Elements. The Lit element is the base class that manages element properties and attributes.&lt;/p&gt;

&lt;p&gt;You might be wondering what the hell is Lit? &lt;a href="https://lit.dev/docs/"&gt;Lit&lt;/a&gt; is a simple library for building fast, lightweight web components. With its boilerplate-killing component base class, it offers reactive state, scoped styles, and a declarative template system. You can build just about any type of web interface with Lit.&lt;/p&gt;

&lt;p&gt;In the meantime, you can check out Lit's interactive &lt;a href="https://lit.dev/tutorial/"&gt;tutorial &lt;/a&gt; on how easy and fast it is to build fast, lightweight web components.&lt;/p&gt;

&lt;p&gt;Also, check out &lt;a href="https://lit.dev/playground/"&gt;Lit's playground&lt;/a&gt;, where you can view and play around with different elements. I recommend you try to resemble the component example; it's simple and an excellent start for beginners. Check out my &lt;a href="https://github.com/reyes-edwin/IST402_Lab-1"&gt;repository&lt;/a&gt; and see how I did. &lt;/p&gt;

&lt;p&gt;Now that you know how to build your first web component keep exploring! The more you practice, the better you get at it. So happy coding!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components"&gt;https://developer.mozilla.org/en-US/docs/Web/Web_Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en/"&gt;https://nodejs.org/en/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://lit.dev/docs/"&gt;https://lit.dev/docs/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>webcomponents</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
