<?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: Nida Shaikh</title>
    <description>The latest articles on DEV Community by Nida Shaikh (@anonyda).</description>
    <link>https://dev.to/anonyda</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%2F475630%2F3354c0e1-ced5-4151-bacd-d689e05a2b41.jpg</url>
      <title>DEV Community: Nida Shaikh</title>
      <link>https://dev.to/anonyda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anonyda"/>
    <language>en</language>
    <item>
      <title>How the Web Works (For Backend Devs)</title>
      <dc:creator>Nida Shaikh</dc:creator>
      <pubDate>Thu, 01 Oct 2020 15:03:06 +0000</pubDate>
      <link>https://dev.to/anonyda/the-backend-dev-s-web-109e</link>
      <guid>https://dev.to/anonyda/the-backend-dev-s-web-109e</guid>
      <description>&lt;p&gt;As beginners, we always seem to hear these terms: &lt;code&gt;front-end&lt;/code&gt; and &lt;code&gt;back-end&lt;/code&gt;. Initially, we are too afraid to ask what that means. We usually Google them. And that's when we know, &lt;strong&gt;front end deals with user interface code&lt;/strong&gt; and &lt;strong&gt;back end deals with the server-side code&lt;/strong&gt;. But then, they are the Lemon and Water of the Lemonade. They both combine to create the wonder we know as the World Wide Web.&lt;/p&gt;

&lt;p&gt;In my &lt;a href="https://dev.to/anonyda/how-the-web-works-for-front-end-devs-2g6c"&gt;previous post&lt;/a&gt;, I discussed how the web works for front end developers, how the Internet mainly consists of &lt;em&gt;Clients&lt;/em&gt; and &lt;em&gt;Servers&lt;/em&gt;. I touched topics of requests and responses, and how does the Client handle the responses to give you a seamless User Interface. &lt;em&gt;The Lemon of our Lemonade.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's talk about Water now.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Server
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F11m1co8pkbcvkyf1hkke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F11m1co8pkbcvkyf1hkke.png" alt="Alt Text" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We know that when the Client requests, the Server responds. The Server is 100% responsible for what those responses are. It controls what happens to the resources and data and how to send them to the Client. We'll look at the most basic website server configuration.&lt;/p&gt;

&lt;p&gt;So a server is a machine that is connected to the Internet. It has its IP Address. The reason why your machine has an IP Address but no one on the Internet can access files in your machine is because you don't have a web server software running on your machine. &lt;/p&gt;

&lt;p&gt;When you have a web server software running on your machine, it will listen to &lt;em&gt;requests&lt;/em&gt;, and it has access to specific files and folders on your machine. You can configure different hosts to different folders.&lt;/p&gt;

&lt;p&gt;Let's take an example of our very own dummy site. Suppose my web server and file system are configured in the following way:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0dyqpqk0izjgm4w59pw4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0dyqpqk0izjgm4w59pw4.png" alt="Alt Text" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I request for &lt;code&gt;www.dummysite.com&lt;/code&gt;, without any path, the Server will respond with the &lt;code&gt;index.html&lt;/code&gt; file, with Content-Type: &lt;code&gt;text/html&lt;/code&gt;. &lt;br&gt;
Likewise, if I give it a path, like &lt;code&gt;www.dummysite.com/login.php&lt;/code&gt;, it will look through my file system and check whether it exists. Hmm.. let's see if a login.php file exists. Oh, it does! Let's send that back as a response and since its a PHP file, it is smart enough to send the response with Content-Type: &lt;code&gt;application/x-httpd-php&lt;/code&gt;. Similar for the style.css file.&lt;/p&gt;

&lt;p&gt;Let's see how Google does it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3j68bfqw670m9kdu0v3i.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3j68bfqw670m9kdu0v3i.PNG" alt="Alt Text" width="525" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;authority = host + port number&lt;br&gt;
The Host is either domain name or IP Address, and the port number for HTTP is &lt;code&gt;80&lt;/code&gt;. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can see in the image, the &lt;code&gt;authority&lt;/code&gt; is said to be &lt;code&gt;www.google.com.&lt;/code&gt; So when it gets the request for the same, your webserver goes like, "ah... google.com? Let's look inside the specified folder in the filesystem." So a basic web server will give you the file you request. That's it, not very smart stuff.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fazgh8bwet6rt8j4k7qsj.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fazgh8bwet6rt8j4k7qsj.PNG" alt="Alt Text" width="525" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the key job for the Server is, it forms a &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL" rel="noopener noreferrer"&gt;Uniform Resource Locator&lt;/a&gt; that consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protocol (HTTP, HTTPS)&lt;/li&gt;
&lt;li&gt;Domain Name (&lt;a href="http://www.dummysite.com" rel="noopener noreferrer"&gt;www.dummysite.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Port Number (80, for HTTP, and it is not visible to us)&lt;/li&gt;
&lt;li&gt;Path to the File (/styles/style.css)
And together it becomes &lt;code&gt;http://www.dummysite.com/styles/style.css&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;By using this URL, you are actually navigating through the server's files, and your browser knows what to do with those files and you can view and interact with the website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So that's the job for a server, which interacts with the backend code. It works for most websites that can be built and run smoothly and without any hassle. &lt;/p&gt;

&lt;p&gt;But surely, websites like Facebook, Twitter doesn't do this! They have to manage users and posts and likes and comments, all that stuff. They're not responding with just a .png file. So how does a complex website handle all these things? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We will look into that in the upcoming post!&lt;/strong&gt;&lt;br&gt;
I hope that I could make this jargon easier for you :)&lt;br&gt;
&lt;em&gt;Till then, signing off!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How the Web Works (for Front End Devs)</title>
      <dc:creator>Nida Shaikh</dc:creator>
      <pubDate>Sat, 26 Sep 2020 15:10:26 +0000</pubDate>
      <link>https://dev.to/anonyda/how-the-web-works-for-front-end-devs-2g6c</link>
      <guid>https://dev.to/anonyda/how-the-web-works-for-front-end-devs-2g6c</guid>
      <description>&lt;p&gt;Before we start learning how to make websites, we need to know &lt;strong&gt;how the Web works&lt;/strong&gt;. That's one of the mistakes I did when I started my web development journey - I started by building websites, but I never made an effort to understand the platform my websites are going to work on. &lt;br&gt;
I say it's an honest mistake because, as Socrates said, &lt;code&gt;we don't know what we don't know&lt;/code&gt;. We don't know what to Google, and in turn we don't get exposed to the crucial things we need to know!&lt;/p&gt;

&lt;p&gt;Here's my attempt to explain how does the Internet work, from a web development point of view.&lt;br&gt;
Let's get started.&lt;/p&gt;

&lt;p&gt;Everything on the internet is either a &lt;em&gt;Client&lt;/em&gt; or a &lt;em&gt;Server&lt;/em&gt;. The Client requests and the Server responds. Simply put, your machine, uses your Browser to request some resources from a server, and the server responds. And the server is another machine connected to the internet. That's what is happening overall. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdat9yqrlg0z5pg7gbxvw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdat9yqrlg0z5pg7gbxvw.png" alt="Client Server" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So here, the Client can be anything - your mobile phone or laptop, using any browser, like Chrome, Firefox, Edge.&lt;br&gt;
And, the server would be the websites, web services or apps you are trying to access.&lt;/p&gt;
&lt;h3&gt;
  
  
  Let's go into a little depth.
&lt;/h3&gt;

&lt;p&gt;Every machine on the internet has an IP address. An IP address, which can be used to access anything that is connected to the internet. In fact, your laptop has an IP address too. But the servers are special kind of machine that have some &lt;em&gt;resources&lt;/em&gt; to offer. So whenever you, as a client, type in any website in the browser, say &lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt;, you are directed to a Domain Name Server (DNS) Lookup. A DNS is like a table that maps &lt;em&gt;domain names&lt;/em&gt; (like google.com) to it's IP Address. &lt;br&gt;
&lt;strong&gt;When you visit &lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt;, you are sending a &lt;em&gt;request&lt;/em&gt; to Google's Servers&lt;/strong&gt;.&lt;br&gt;
In return, Google's server will give you a response. The response typically consists of &lt;strong&gt;Content-Type&lt;/strong&gt;. This property helps the browser evaluate what type of content has the server responded with. Now, visiting google.com might respond with an HTML webpage, that the browser will recognize by its content-type: &lt;code&gt;text/html&lt;/code&gt;, it will now what to do with it. It will parse the response as HTML file.&lt;/p&gt;

&lt;p&gt;Suppose we got the following HTML as response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
   &amp;lt;head&amp;gt;
      &amp;lt;link href="/styles/main.css" /&amp;gt;
   &amp;lt;/head&amp;gt;
   &amp;lt;body&amp;gt;
     :
     :
     &amp;lt;script src="/javascript/app.js" /&amp;gt;
   &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, when the browser comes across the &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tag, it would say, 'ah, I need this asset for this webpage. Let's request this from the server.' That's when the browser would request the &lt;code&gt;main.css&lt;/code&gt; file, and the server will send over the file, with the Content-Type as &lt;code&gt;text/css&lt;/code&gt;. Same goes for the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;

&lt;p&gt;Let's see an example:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbc4tj6hhk355vooznvo3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbc4tj6hhk355vooznvo3.jpg" alt="Content-Type" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This says, &lt;code&gt;content-type : image/gif&lt;/code&gt;. So the browser knows that this particular asset is an image and it displays on the webpage accordingly. &lt;/p&gt;

&lt;p&gt;You could just Inspect Element on any webpage, and go to the Network Tab, click on any asset that is returned. It will show you the corresponding request and response!&lt;/p&gt;

&lt;h4&gt;
  
  
  Some other requests and responses you could look out for:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.w3schools.com/tags/ref_httpmethods.asp" rel="noopener noreferrer"&gt;method&lt;/a&gt;: The HTTP Methods enable the client to specify the action to be performed with assets or resources.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie" rel="noopener noreferrer"&gt;cookies&lt;/a&gt;: Cookies are small pieces of data that are stored in your local machine to remember useful information, or record your browsing activity.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status" rel="noopener noreferrer"&gt;status code&lt;/a&gt;: These are the codes issued by the server in response to the client's request.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There you go! Now, you know what you don't know. In the end, I would like to say that knowing how the web works wouldn't contribute to writing building websites in the short run but will yield long term benefits because you know what is happening behind the scenes.&lt;/p&gt;

&lt;p&gt;Did I miss something? I would love feedback.&lt;br&gt;
&lt;em&gt;Signing off!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
