<?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: Erik</title>
    <description>The latest articles on DEV Community by Erik (@erikgraybill).</description>
    <link>https://dev.to/erikgraybill</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%2F795052%2F45b3ff2a-2062-4deb-acf6-e72fe6b08c89.jpeg</url>
      <title>DEV Community: Erik</title>
      <link>https://dev.to/erikgraybill</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/erikgraybill"/>
    <language>en</language>
    <item>
      <title>Developer Experience with Vercel</title>
      <dc:creator>Erik</dc:creator>
      <pubDate>Sun, 13 Mar 2022 20:36:21 +0000</pubDate>
      <link>https://dev.to/erikgraybill/developer-experience-with-vercel-4k64</link>
      <guid>https://dev.to/erikgraybill/developer-experience-with-vercel-4k64</guid>
      <description>&lt;h2&gt;
  
  
  What is Vercel?
&lt;/h2&gt;

&lt;p&gt;Vercel is a platform that allows you to import existing applications or make new ones from a template and deploy them easily. Vercel is based on UI functions which makes the developer experience much easier, and it offers many customization options.&lt;/p&gt;

&lt;p&gt;Companies like Marvel, McDonald's, IBM, and more use Vercel for use cases such as marketing, news, and ecommerce. In this article, we will walk through deploying a basic application and 11ty sites with Vercel, as well as discuss why Vercel may be the best choice for your application's CI/CD pipeline. For further reading on Vercel, check out their &lt;a href="https://vercel.com/docs"&gt;documentation&lt;/a&gt;, or &lt;a href="https://www.redhat.com/architect/micro-frontend-architecture"&gt;this article&lt;/a&gt; by Michael Potter at Red Hat.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying an application with Vercel
&lt;/h2&gt;

&lt;p&gt;To get started, be sure to have a GitHub account as it will need to be linked to your Vercel account. An existing repository with an application is also necessary to continue. Once your accounts are linked, go to your Vercel Dashboard and click &lt;code&gt;+ New Project&lt;/code&gt;. Import the application repository from your GitHub account, give this project a name. You are free to change the settings shown in the following screenshot.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X1hfiToy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/szxx0ihz5kp5sciyxcoy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X1hfiToy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/szxx0ihz5kp5sciyxcoy.png" alt="project settings" width="650" height="956"&gt;&lt;/a&gt;&lt;br&gt;
One setting I recommend altering is the &lt;code&gt;Output Directory&lt;/code&gt; to ensure the project builds and deploys correctly. In my case, my application's output directory is called &lt;code&gt;_site&lt;/code&gt;. It can be left at default, but I found issues with building the project with Vercel in doing so.&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Deploy&lt;/code&gt;, and Vercel will take care of building and deploying your application! To update the build or to get it to run initially, push code to your Git repository and Vercel will do it automatically.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RR79FytK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ec4ork05ncblhnub77m9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RR79FytK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ec4ork05ncblhnub77m9.png" alt="deployed demo app" width="880" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying 11ty Sites with Vercel
&lt;/h2&gt;

&lt;p&gt;Deploying an 11ty site is just as easy! Follow the same steps: import your Git repo with the 11ty site into Vercel, change any settings or leave the defaults, and hit &lt;code&gt;Deploy&lt;/code&gt;. This shows how easy Vercel is to use, and how versatile it can be with different types of applications.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Adu4L6Wm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rk3657dxno0fni0bgeun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Adu4L6Wm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rk3657dxno0fni0bgeun.png" alt="demo blog" width="880" height="715"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H8Dpmnkn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ldj0wc7vzrun3fyigzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H8Dpmnkn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ldj0wc7vzrun3fyigzq.png" alt="template blog 1" width="880" height="721"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qFyoFLq8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xzkob5cz9t4a0mqffxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qFyoFLq8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xzkob5cz9t4a0mqffxz.png" alt="template blog 2" width="880" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CI/CD Pipeline Comparisons
&lt;/h2&gt;

&lt;p&gt;In the CI/CD pipeline, Vercel is the quickest and easiest to work with that I have used. In combination with GitHub actions, Vercel works automatically every time you push code to the connected repo, and the build and deployment is fully customizable through a user interface. In the past, I used code in a YAML file in my CI/CD pipeline. This works, but the user interface Vercel has makes this much easier to maintain. The developer experience with using Vercel is great since it is so versatile, customizable, and "just works" for any of your applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a DockerFile for an Application</title>
      <dc:creator>Erik</dc:creator>
      <pubDate>Fri, 25 Feb 2022 20:52:25 +0000</pubDate>
      <link>https://dev.to/erikgraybill/creating-a-dockerfile-for-an-application-5i0</link>
      <guid>https://dev.to/erikgraybill/creating-a-dockerfile-for-an-application-5i0</guid>
      <description>&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;Docker is a platform for developing, shipping, and running applications. Docker is a very powerful tool because it allows you to run applications in environments called containers. Numerous containers can be run on a single host, and they provide isolation and security for the applications packaged inside. The containers themselves are lightweight and contain everything needed to run the application, so nothing is required from the host to run anything. Docker provides fast, consistent delivery, and rapid deployment of applications. In this article we will walk through how to deploy an app with Docker, and see how to create a DockerFile for an existing application&lt;/p&gt;

&lt;h2&gt;
  
  
  'Play with Docker'
&lt;/h2&gt;

&lt;p&gt;'Play with Docker' is an easy way to use Docker and deploy applications. To start using it, first sign up for &lt;a href="https://hub.docker.com/signup" rel="noopener noreferrer"&gt;Docker Hub&lt;/a&gt;. Once you have an account, go &lt;a href="https://labs.play-with-docker.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt; and log into your Docker account to start using 'Play with Docker'. Sessions last 4 hours, and all work is deleted once the time is up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying the NewsAPI Microservice
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;First Steps&lt;/strong&gt;&lt;br&gt;
Within the playground, click '+ADD NEW INSTANCE'. Once the console loads, run &lt;code&gt;git clone https://github.com/heyMP/news-api-workshop &amp;amp;&amp;amp; cd news-api-workshop&lt;/code&gt; to clone the repository with the API to and change directory to the local repo. An API key and the url of your Docker playground need to be specified, so run &lt;code&gt;cp dot.env.example dot.env&lt;/code&gt; to generate the settings file. A dot.env file was created, so navigate to the 'EDITOR' button and find it. Once opened, you should see a file similar to the following screenshot, with fields for the API key and url (NEWS_ENDPOINT).&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%2Fayz0jcx3ao45rklg2c6z.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%2Fayz0jcx3ao45rklg2c6z.png" alt="dot.env file inside EDITOR"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get API Key and URL of Docker Playground&lt;/strong&gt;&lt;br&gt;
Go to the &lt;a href="//newsapi.org"&gt;News API&lt;/a&gt; site to create an account, login, and generate an API key. Once you obtain the key, paste it into the NEWS_SERVICE_API_KEY field in the dot.env file. To get the url for the news endpoint, go back to your Docker playground and click 'OPEN PORT'. When prompted, set port &lt;code&gt;4000&lt;/code&gt; to be opened. Click OK, and you should see a blank page. Copy that url and paste it into the NEWS_ENDPOINT field in the dot.env file. Save the dot.env file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run Docker&lt;/strong&gt;&lt;br&gt;
Back in the terminal, run &lt;code&gt;docker-compose up&lt;/code&gt; to build the Docker image. Two ports will show up as opened, &lt;code&gt;80&lt;/code&gt; and &lt;code&gt;4000&lt;/code&gt;. If you've done everything properly, you will be taken to a screen that looks like the following screenshot when you click &lt;code&gt;80&lt;/code&gt;.&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%2F0fnc579zt2q6pfjxyj1n.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%2F0fnc579zt2q6pfjxyj1n.png" alt="News API working properly"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a DockerFile for an Existing Application
&lt;/h2&gt;

&lt;p&gt;Getting an existing app to work with Docker is simple; you just need a DockerFile! An example DockerFile can be found below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:12-alpine as dev
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD [ "npm", "start" ]

FROM node:12-alpine as build
WORKDIR /app
COPY --from=dev /app /app
RUN npm build
CMD [ "npm", "build" ]

FROM nginx as prod
COPY --from=build /app/_site /usr/share/nginx/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should be named &lt;code&gt;Dockerfile&lt;/code&gt; and placed in the root directory of your application. Note that this is not the Docker image required to run the application, this is only the text file with a list of commands to be used by a Docker command. The command is &lt;code&gt;docker build -t &amp;lt;appname&amp;gt; .&lt;/code&gt;, which builds the application using the Dockerfile. &lt;strong&gt;Do not forget the &lt;code&gt;.&lt;/code&gt; at the end of the command.&lt;/strong&gt; After this command executes, a container can be instantiated by running the command &lt;code&gt;docker run -d -p 3000:3000 &amp;lt;appname&amp;gt;&lt;/code&gt;. Your application is now deployed with Docker!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting Started with 11ty</title>
      <dc:creator>Erik</dc:creator>
      <pubDate>Fri, 25 Feb 2022 20:16:38 +0000</pubDate>
      <link>https://dev.to/erikgraybill/getting-started-with-11ty-86k</link>
      <guid>https://dev.to/erikgraybill/getting-started-with-11ty-86k</guid>
      <description>&lt;p&gt;11ty is a static site generator that is extremely flexible and customizable. Multiple templates can be used, and it can be written in many different languages including JavaScript and Markdown. In this article we will walk through how to set up your first 11ty site from scratch and with templates, and compare the user experiences of both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Site
&lt;/h2&gt;

&lt;p&gt;We will follow the guidelines &lt;a href="https://www.11ty.dev/docs/getting-started/" rel="noopener noreferrer"&gt;here&lt;/a&gt; to create the first website, but first you need to have at least version 12 of &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;. Once you have Node 12 or higher installed, create a directory to put your site and run the command &lt;code&gt;npm init -y&lt;/code&gt; to create a package.json file that is required for 11ty to run. Next, install and save 11ty to the package.json by running &lt;code&gt;npm install --save-dev @11ty/eleventy&lt;/code&gt;. 11ty will need files to run, so create an &lt;code&gt;index.html&lt;/code&gt; file in your directory, and add some content to it. You can run 11ty by typing the command &lt;code&gt;npx @11ty/eleventy&lt;/code&gt; to compile any files you create, and then &lt;code&gt;npx @11ty/eleventy --serve&lt;/code&gt; to run the site locally. Go to &lt;code&gt;http://localhost:8080/&lt;/code&gt; to see your site in action!&lt;/p&gt;

&lt;h2&gt;
  
  
  Using a Template
&lt;/h2&gt;

&lt;p&gt;Using an 11ty template is just as simple. First, find a template like the one &lt;a href="https://github.com/11ty/eleventy-base-blog" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Store this repository locally, and configure the template like you did above! Below I have linked three Git Repos and screenshots of the 11ty sites I generated with them for you to check out:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11ty Blog from scratch &lt;a href="https://github.com/erikgraybill/eleventy-sample" rel="noopener noreferrer"&gt;repository&lt;/a&gt;&lt;/strong&gt;&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%2Ftf0dd9dk0iepeppnvo3g.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%2Ftf0dd9dk0iepeppnvo3g.png" alt="Blog from scratch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11ty Base Blog Template &lt;a href="https://github.com/erikgraybill/eleventy-template-blog" rel="noopener noreferrer"&gt;repository&lt;/a&gt;&lt;/strong&gt;&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%2Fpoeqgmaqvrv4ji66sthn.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%2Fpoeqgmaqvrv4ji66sthn.png" alt="Blog from Base Blog Template"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11ty Captain's Log Template &lt;a href="https://github.com/erikgraybill/eleventy-third" rel="noopener noreferrer"&gt;repository&lt;/a&gt;&lt;/strong&gt;&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%2Flxvpetjc537xxt9nyvnd.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%2Flxvpetjc537xxt9nyvnd.png" alt="Blog from Captain's Log Template"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  User Experience
&lt;/h2&gt;

&lt;p&gt;Let's compare the experience with making an 11ty blog from scratch and with templates. Starting from scratch is a good option if you want complete control over what you want your blog to look like. You can edit templates, but starting from scratch allows you to control every little detail. One downside to starting from scratch is that everything must be built from the ground up, from styles to content.&lt;/p&gt;

&lt;p&gt;Making a blog with a template makes development easier since there is preexisting structure and styling, so you don't need to worry as much about that and can work right away on the content. The one downside to using templates is that you need to understand that predetermined structure, and if they use any languages or tools you are unfamiliar with, you will need to learn them to be able to fully edit the template.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Overall, 11ty is a powerful tool to create good-looking blogs. Whether you choose to build a blog from scratch or use a template, 11ty makes static site generation easier for all developers.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Wikipedia's API, and Using 'wikipedia-query' to Fetch Articles</title>
      <dc:creator>Erik</dc:creator>
      <pubDate>Mon, 31 Jan 2022 01:42:14 +0000</pubDate>
      <link>https://dev.to/erikgraybill/wikipedias-api-and-using-wikipedia-query-to-fetch-articles-5clk</link>
      <guid>https://dev.to/erikgraybill/wikipedias-api-and-using-wikipedia-query-to-fetch-articles-5clk</guid>
      <description>&lt;p&gt;Let's say you want to display information about a company, city, or your favorite food on your website. Of course you could just write it out yourself, but what if something changes or gets updated with better information? You can use Wikipedia's API to find an article from their website using regular search terms. In this blog, we will find out how to do this, but first we will talk about the &lt;code&gt;fetch()&lt;/code&gt; JavaScript function. I will use my project &lt;a href="https://github.com/erikgraybill/ip-project"&gt;here&lt;/a&gt; as an example.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fetch()&lt;/code&gt; is an asynchronous function, meaning it can execute as other code is running at the same time; it will return whatever data is gathered whenever it can and the rest of the code continues on. It is used for HTTP requests and responses. You can learn more about the function &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch"&gt;here&lt;/a&gt;. In my example, the fetch function is used to return a JSON response with information about the user's location from &lt;a href="https://freegeoip.app/json/"&gt;https://freegeoip.app/json/&lt;/a&gt;. Once the function receives the information, it returns it and the code within &lt;code&gt;.then&lt;/code&gt; executes.&lt;br&gt;
&lt;em&gt;Example JSON retrieved from fetch()&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;From here, my code takes the information from the JSON response and stores it for later use in the Wikipedia query, as seen in this screenshot. &lt;em&gt;I specifically use city and state for the query.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DEwqca9t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dn4bw5lff4kl6rxnhxm9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DEwqca9t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dn4bw5lff4kl6rxnhxm9.png" alt="Image description" width="518" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  MediaWiki API
&lt;/h2&gt;

&lt;p&gt;We will begin with looking at the API itself. This API can perform many different actions and be utilized in very specified ways dependent on the use case, but we will focus on the action, origin, and format parameters here. Full documentation of the API can be found &lt;a href="https://en.wikipedia.org/w/api.php"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;origin&lt;/strong&gt; sets the originating domain of the information being queried. In my instance, this is set to '*' to signify a non-authenticated request which still works, but some user-specific functions are disabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;action&lt;/strong&gt; specifies which action is to be performed. In our case, we will set this to 'query'.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;format&lt;/strong&gt; is self explanatory, and specifies what format the information will be returned as. In my case, it is set to return JSON.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When performing &lt;code&gt;action=query&lt;/code&gt;, some more parameters can be specified. In my case, I use &lt;strong&gt;prop&lt;/strong&gt; and set it to 'extracts' in order to get the plain text of the given page being fetched, as well as &lt;strong&gt;titles&lt;/strong&gt; which specifies what the title of the page to be returned. This is set to be the term being queried in &lt;code&gt;wikipedia-query&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  wikipedia-query
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gCTTXm4g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/na9lsrk4gy8ff6hj8tbz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gCTTXm4g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/na9lsrk4gy8ff6hj8tbz.png" alt="Image description" width="880" height="271"&gt;&lt;/a&gt; Now it's time to implement the MediaWiki API. The code pictured above is the block within the &lt;code&gt;wikipedia-query&lt;/code&gt; tag that uses the MediaWiki API. It uses &lt;code&gt;fetch()&lt;/code&gt; to send a query via the API, and the query has the titles parameter set to a variable. I use three &lt;code&gt;wikipedia-query&lt;/code&gt; tags to display the city and state, just the city, and just the state of the user using the data that was stored earlier from &lt;a href="https://freegeoip.app/json/"&gt;https://freegeoip.app/json/&lt;/a&gt;. In the picture below, you can see how the search term is constructed in my code.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cl8190t7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yrfflah5q1fhpxksvhbr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cl8190t7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yrfflah5q1fhpxksvhbr.png" alt="Image description" width="711" height="84"&gt;&lt;/a&gt; So, in this example, three queries are sent to the MediaWiki API: one with title set to State College, Pennsylvania, one set to State College, and one set to Pennsylvania. The following picture shows a portion of what is returned from the MediaWiki API, what isn't shown is just the rest of the article.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DiYZZ5Mq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59j14w9imh9jtjs780x4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DiYZZ5Mq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59j14w9imh9jtjs780x4.png" alt="Image description" width="880" height="319"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;You can see the that 'title' is the search term, and extract is the HTML version of the Wikipedia article for State College, Pennsylvania. The page id is also given.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In summary, my example fetches a JSON response with the user's location information and stores it. The &lt;code&gt;wikipedia-query&lt;/code&gt; tag invokes the MediaWiki API, takes the search term (in my case, city and state, city, and state in three separate queries), and sets the API 'titles' parameter to that term. The MediaWiki API then sends the query and retrieves the Wikipedia article for the given title (aka search term) in JSON format.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>An Introduction to Open Web Components</title>
      <dc:creator>Erik</dc:creator>
      <pubDate>Sun, 16 Jan 2022 23:45:14 +0000</pubDate>
      <link>https://dev.to/erikgraybill/an-introduction-to-open-web-components-297</link>
      <guid>https://dev.to/erikgraybill/an-introduction-to-open-web-components-297</guid>
      <description>&lt;p&gt;JavaScript is used widely across the internet, as it is natively run in your web browser. As a web developer, familiarizing yourself with JavaScript is vital to success. Open-wc streamlines aspects of development and utilizes Node.js and npm. From the open-wc Git Repository's README: "Open Web Components provides a set of defaults, recommendations and tools to help facilitate your web component project."&lt;/p&gt;

&lt;p&gt;What do Node.js and npm have to do with JavaScript? Node.js is a cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. The Node Package Manager, or npm, is a software registry of over 800,000 packages installed alongside Node.js according to w3schools. Node.js is one of the most popular tools for open-source developers to work with JavaScript. In this article, I will walk through the steps required to start using open-wc on a Windows machine.&lt;/p&gt;

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

&lt;p&gt;First things first, you will need an IDE to work with JavaScript. You may use any IDE you are comfortable with if it is compatible with JavaScript, but I will be using Visual Studio Code which can be downloaded &lt;a href="https://code.visualstudio.com/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Node.js and npm
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d4Q8WEgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qkk0ponf32aod6a3gqwl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d4Q8WEgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qkk0ponf32aod6a3gqwl.png" alt="Download page" width="880" height="413"&gt;&lt;/a&gt;&lt;br&gt;
To install Node.js, go &lt;a href="https://nodejs.org/en/download/"&gt;here&lt;/a&gt;. Get the most current LTS version for your operating system for the best stability, or the latest current version for new features at the cost of some stability. Since npm is included with the Node.js install, you should now have both; open your terminal and enter &lt;code&gt;node -v&lt;/code&gt; to check if Node.js was installed, and &lt;code&gt;npm -v&lt;/code&gt; to check if npm was installed. You're all set to continue if you see version numbers after running those commands.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hbjnAYnJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivrqvddmt4b436pqlh5u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hbjnAYnJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivrqvddmt4b436pqlh5u.png" alt="Check if Node.js and npm are installed" width="638" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting a new open-wc project
&lt;/h2&gt;

&lt;p&gt;To begin with open-wc, make a directory to put your project in. Change your terminal directory to this new location, and enter &lt;code&gt;npm init @open-wc&lt;/code&gt;. If everything has been installed correctly, this should run and you can now begin working on your open-wc project. I initialized my project with these options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New project scaffold&lt;/li&gt;
&lt;li&gt;Web component&lt;/li&gt;
&lt;li&gt;Linting, Testing, and Demoing enabled&lt;/li&gt;
&lt;li&gt;No TypeScript&lt;/li&gt;
&lt;li&gt;Install using npm&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sGZP8K7c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/045vzmnqn7t8awe2qwo5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sGZP8K7c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/045vzmnqn7t8awe2qwo5.png" alt="open-wc initialization" width="880" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The hello-world element is located in the &lt;code&gt;/src/&lt;/code&gt; folder to be edited further. And with that, you have just created your first web component!&lt;/p&gt;

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

</description>
    </item>
  </channel>
</rss>
