HTTP
What is it?
HTTP (Hypertext Transfer Protocol) is a communication protocol for sending and receiving information. Since the Web uses the HTTP protocol as a method for exchanging data between the browser and the server, it is one of the essential knowledge for front-end developers.
HTTP Features
The HTTP protocol is a stateless protocol.
Stateless here means that each data request to send and receive data is managed independently of each other.
This means the server will never remember the last request, no matter what. Therefore, even if the browser asks about the last request, the server cannot give any answer.
Thanks to this feature, the server does not need to manage additional information such as sessions, and there is a performance advantage that can handle a large number of requests and reduce the load on the server.
How does it work?
In order to send and receive data through HTTP, you need to send a request and receive a response as shown in the figure below. (Req and Res are often used when writing code.)
URL
To understand how HTTP works, you must first know about URLs. URL (Uniform Resource Locators) is an English address entered to send a request to the server.
Request
You can request data from the server by using the URL shown above. If you want to perform a specific action on the requested data here, you can use the HTTP Request Methods.
In general, HTTP request methods are also called HTTP verbs and have main methods as follows.
- GET: request data
- POST: Generate data
- PUT: data change
- DELETE: delete data
HTTP Status code
- Response information set by the server
- It provides detailed information about various statuses, such as whether the request succeeded or failed, what was the cause of the failure, and so on.
Click here to see all HTTP status codes