<?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: Jocelyn Vargas</title>
    <description>The latest articles on DEV Community by Jocelyn Vargas (@jocelynvargas123).</description>
    <link>https://dev.to/jocelynvargas123</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%2F1045326%2Fb34c4387-3bd4-4cac-a800-f5e054e57e85.jpg</url>
      <title>DEV Community: Jocelyn Vargas</title>
      <link>https://dev.to/jocelynvargas123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jocelynvargas123"/>
    <language>en</language>
    <item>
      <title>What is Fetch?</title>
      <dc:creator>Jocelyn Vargas</dc:creator>
      <pubDate>Mon, 24 Jul 2023 00:37:31 +0000</pubDate>
      <link>https://dev.to/jocelynvargas123/what-is-fetch-4ac3</link>
      <guid>https://dev.to/jocelynvargas123/what-is-fetch-4ac3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Fetch&lt;/strong&gt; is a built-in web API in JavaScript that allows us to make a network request. From fetching data from a server or sending data to a server. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Fetch API was primarily driven by a team of developers from various companies, including Mozilla, Google, Microsoft, and others who were part of the WHATWG. It became widely adopted in modern browsers and is now a standard feature of JavaScript, providing a more modern and powerful mechanism for making network requests and handling responses.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  With the Fetch, you can make various types of requests, including:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GET Request: Fetch data from a server.&lt;/li&gt;
&lt;li&gt;POST Request: Send data to a server to create a new resource.&lt;/li&gt;
&lt;li&gt;PUT Request: Send data to a server to update an existing resource.&lt;/li&gt;
&lt;li&gt;DELETE Request: Request a server to delete a resource.&lt;/li&gt;
&lt;li&gt;HEAD Request: Similar to GET, but only fetches the headers, not the content.&lt;/li&gt;
&lt;li&gt;PATCH Request: Partially update a resource on the server.&lt;/li&gt;
&lt;li&gt;OPTIONS Request: Retrieve information about the communication options available for a resource.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can specify the HTTP method when making a fetch request by providing the appropriate method name in the options object as the second argument to the fetch function.&lt;/p&gt;

&lt;h2&gt;
  
  
  GET Request
&lt;/h2&gt;

&lt;p&gt;To make a GET request, you use the fetch function and provide the URL you want to fetch data from. fetch returns a Promise that resolves to the Response object containing the data.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Post Request
&lt;/h2&gt;

&lt;p&gt;To make a POST request and send data to the server, you provide an options object as the second argument to fetch, which includes the method, headers, and body. &lt;/p&gt;

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

&lt;p&gt;In this example, we send a JSON object (dataToSend) as the payload in the request body. We set the Content-Type header to 'application/json' to indicate that we are sending JSON data.&lt;/p&gt;

&lt;p&gt;When the server receives the POST request, it can access the sent data in the request body and process it accordingly. Always ensure that the server-side API is set up to handle POST requests and respond appropriately.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Response
&lt;/h2&gt;

&lt;p&gt;When using the Fetch API, you can handle the response from the server using the .then() and .catch() methods, which are part of the Promises returned by the fetch function. The response object contains useful information such as headers, status, and the data returned from the server.&lt;/p&gt;

&lt;p&gt;Depending on what response you get like JSON data you can use .json() method to parse the response and extract the data. This method also returns a Promise, so you can chain another .then() to handle the parsed data. As shown above. Another type of response could be a plain text instead of JSON, you can use the .text() method to read the response as text.&lt;/p&gt;

&lt;p&gt;When handling errors you can use the .catch() method at the end of the fetch chain to handle any that occur during the fetch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IYG3U1jB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wxrhm6tcz8kaaaeyg9q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IYG3U1jB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wxrhm6tcz8kaaaeyg9q.jpeg" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember to use the appropriate HTTP method that matches the operation you want to perform on the server. The Fetch API provides a simple and consistent way to interact with APIs and make various types of requests in JavaScript.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Hello World: Reflections of a Newbie Developer</title>
      <dc:creator>Jocelyn Vargas</dc:creator>
      <pubDate>Sun, 02 Apr 2023 20:46:40 +0000</pubDate>
      <link>https://dev.to/jocelynvargas123/hello-world-reflections-of-a-newbie-developer-7ho</link>
      <guid>https://dev.to/jocelynvargas123/hello-world-reflections-of-a-newbie-developer-7ho</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Hi, there! I'm Jocelyn Vargas&lt;/strong&gt;, a new software engineer.
&lt;/h2&gt;

&lt;p&gt;I'm passionate, creative, hardworking... and relatively new to the field, but I'm eager to learn and grow as a developer. Currently, I'm focused on learning the ropes and gaining experience in various programming languages and technologies. &lt;/p&gt;

&lt;p&gt;When I'm not coding, you can find me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In my garden with my +50 different types of plants(&lt;em&gt;I am very into horticulture&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Reading a good book(&lt;em&gt;mystery and adventure&lt;/em&gt;) &lt;/li&gt;
&lt;li&gt;Or solving 2000-piece puzzles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UQf_YroI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrresv0vxnxsqnae7ntl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UQf_YroI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrresv0vxnxsqnae7ntl.gif" alt="Image description" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog, I'll be sharing my experiences and insights on different programming languages. &lt;br&gt;
I'll be covering topics such as JavaScript, functions, arrays, objects, etc., and sharing tips and tricks that I've learned along the way. &lt;/p&gt;

&lt;h2&gt;
  
  
  What I hope to get out of this blog is confidence in my skills.
&lt;/h2&gt;

&lt;p&gt;I find it hard to not automatically be good at something. &lt;br&gt;
I want to succeed and I put my all into everything I do, so when I started coding I was a bit discouraged. &lt;/p&gt;

&lt;p&gt;Writing a blog about my struggles was the last thing I wanted to admit online. Now that I've had some time to reevaluate my situation I know that I have to fail to succeed. &lt;/p&gt;

&lt;p&gt;I recently struggled to complete a complicated function that took me 5 hours to fully understand but when I did. &lt;/p&gt;

&lt;p&gt;It made me want to research more and understand why I made all the mistakes I did. That wouldn't have happened if I immediately succeeded. &lt;/p&gt;

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

&lt;p&gt;I want this blog to be informative but I also want to share my struggles. So besides the educational post, I'll be making a monthly struggle checks. Therapeutic in a way. &lt;/p&gt;

&lt;p&gt;I'm ready to connect with other software engineers and aspiring developers. I hope we all find success in this field. Let's struggle and learn together. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>codenewbie</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
