DEV Community

Emmanuel Fordjour  Kumah
Emmanuel Fordjour Kumah

Posted on • Updated on

A guide to understanding data exchange on the web

We kicked off our 30 day challenge to learn back-end development yesterday.

To fully appreciate backend development, a knowledge of how data is exchanged on the web is essential.

Our goal in this post is to learn what happens when we type in the URL of a site and press enter.

Exchanging data on the web

Whenever you type in the URL of a website, for instance, www.youtube.com and press the enter key, you are performing a request to a server (which contains files) to fetch some data or resource.

The server receives the request and responds with the requested data, which get displayed as the user interface on the web browser for the user to interact with your web app.

HTTP messages

Data is exchanged between the server and the client using HTTP messages.
HTTP messages are categorized into two: requests messages and response messages.

  • Requests messages are sent by the client (web browser) to initiate an action on the server.
  • Response messages are answers from the server to the client's request.

HTTP Request Methods

The request methods inidicate the desired action to be performed on the server for a given resource.
The usually used HTTP request methods are: GET, POST, PUT, and DELETE.

  • GET: Allows you to retrieve data from the server
  • POST: Allows you to add data to an existing resource on a server
  • PUT: Enable you to replace an existing file or resource on a server
  • DELETE: Allows you to delete a resource from the server

HTTP Response

After receiving a request message, the server needs to respond. An HTTP response is performed by a server to a client.
The objective of the response could be any of the below:

  • Provide the client with the requested resource
  • Inform the client the action it requested has been performed
  • Inform the client an error occured in processing the request

What is a Web Server ?

The web server is a software application that controls how web users access resources hosted on the server.

Whenever you enter the URL of a website in a browser, the browser requests the resource containing the requested information from a web server.

The browser makes this request using HTTP.The web server accepts the request, finds the requested file, and sends it back to the browser using HTTP.

Each HTTP response to the browser has a status code indicating whether a specific HTTP request has been successfully completed.
If the server doesn't find the requested file, it returns a 404 response

Summary

Entering YouTube.com into a web browser sends a request to the server that contains these resources, and the server returns them to you.

In the 30 days challenge, we will be responsible for building these servers using NodeJs and the ExpressJS framework.
This will enable us deliver appropriate response messages for each request made

In day 2, we will learn about NodeJS

In the coming days, we will build our own server where we can host our website files using ExpressJS Framework.

See you

Top comments (0)