Introducing HTTP Communication0:00
I've talked a lot about web browsers and web servers, and the communication between the two, but we haven't really discussed that actual communication. Because really, that's the linchpin. Without knowing how it works, well, it just doesn't work, period. Because everything hinges upon HTTP, Hypertext Transfer Protocol, and it's the set of rules that web browsers and web servers have to follow in order for the web to work. So we would use a web browser to send a request to the web server for a particular resource. It can be a webpage, an image, a CSS file, a JavaScript file, it can be a text file, and that request is formatted according to the rules in the HTTP protocol. It contains the resource that we want to request, the size of the request.
HTTP Requests and Responses0:51
and that request is formatted according to the rules in the HTTP protocol. It contains the resource that we want to request, the size of the request. It also contains any information that we might need to include with the request. But then the web server is going to receive this request and process it, because it understands HTTP, and it will send a response back to the browser. But there are different kinds of requests. We call them HTTP methods. So the most common kind of request is a GET request. We are getting information, and that's exactly what we use it for. We want to get content.
GET vs POST Methods1:28
We are getting information, and that's exactly what we use it for. We want to get content. The second kind of request is a POST request. And this is where we are essentially telling the server that we want to create a new resource. And of course, in order for the server to do that, we need to provide all of the information that the server is expecting to create a new resource. Well, like a blog. You need the title of the blog post, you need the content of the blog post, who created it, and I'm sure that there's other information that we would need, but that's basically it. But then there are other HTTP methods.
Updating and Deleting Resources2:04
it, and I'm sure that there's other information that we would need, but that's basically it. But then there are other HTTP methods. There is a PUT and a PATCH, and both of those are for updating a resource. But then finally, there is a DELETE request. So we would send a DELETE request for the resource that we want to delete, and the server would delete that resource. So that's five different HTTP methods, GET, POST, PUT, PATCH, and DELETE.
