My name is Mason Ellwood, and I’m currently working on Flatiron School’s Online Full Stack Web Development Program. Each week, I’ll be writing about my experience, what I’m learning, and tips on learning to code.
This section that I am currently working through is all about how the internet works. The internet is kinda weird. Or at least is in my opinion. It is this vast multi tool that we use every day and most of the time and most of us, at least at a rudimentary level very vaguely know how it works. Throughout these past post we I have been working through ruby and how to built usable tools with it to accomplish a task, but up until this point all locally. But how does all that work in unison with the “internet”?
This is where servers and databases come in. In basic terms, a database is where all your data is stored and a server is used as a method to serve that data in a displayable form.
“In a technical sense, a server is an instance of a computer program that accepts and responds to requests made by another program, known as a client. Less formally, any device that runs server software could be considered a server as well. Servers are used to manage network resources.”
“A database is a collection of information that is organized so that it can be easily accessed, managed and updated.”
Linking these two powerful tools together, you then are one step closer to completing projects at an industry standard level.
Before diving deeper into this and how that is set up, what the heck is the internet. The internet is basically a conversation between two different things a client which is widely known as a browser and a server or the code running the web site you are trying to load. By typing a URL into a browser you as the client are asking the browser to give you something, a web page. The server then accepts the request as a URL and sends a response or the relevant content that you are looking for. In this leading lessons we will be working with Ruby, and primarily Rack to build out this server. This is the fundamentals of how the web works.
The server and the client are able to speak together with a tool that has been widely adopted using HTTP or Hypertext Transfer Protocol. Your server will be the recipient of the request trailing your HTTP. Think about the request in the diagram below.
The HTTP request is sent to the server, and in return, an HTTP Response is sent back with your relevant content.
When you make requests using the HTTP call the trailing information is known as a URI or Uniform Resource Identifiers or URIs, this is basically the same thing as a URL which you have probably heard of before. These links are broken down into a few parts.
- Http – the protocol
- Youtube.com – the domain
- /adelevevo – the resource
The protocol which is the way of sending your request. The domain name is a string of characters of the part we want to load. Appended with the specific recourse /adelevevo. Thinking about it in these terms simplifies how the internet makes those requests and retrieves specific data.
When building out your server you have to specify what you want the HTTP request to do. We do this with HTTP verbs, you will mainly use GET but there are many others to consider.
- HEAD – Asks for a response like a GET but without the body
- GET – Retrieves a representation of a resource
- POST – Submits data to be processed in the body of the request
- PUT – Uploads a representation of a resource in the body of the request
- DELETE – Deletes a specific resource
- TRACE – Echoes back the received request
- OPTIONS – Returns the HTTP methods the server supports
- CONNECT – Converts the request to a TCP/IP tunnel (generally for SSL)
- PATCH – Apply a partial modification of a resource
In the next lesson, we will get into how to use these verbs and how RACK is used. But before I sign off, there are two different web apps we would like to consider; static and dynamic. A static web app is something that does now change. While a dynamic webapp is something that changes based on user input. But don’t worry too much about that right now. Through The Flatiron School, I will walk you through step by step on how to setup RUBY with RACK and to push you in the right direction to building out your own server.