Lesson 21 of 30

HTTP Methods

Chapter 21

HTTP Methods

Understand GET, POST, PUT, PATCH, and DELETE HTTP methods.

Theory

HTTP methods describe the intended operation of an HTTP request. GET is generally used to retrieve data. POST is generally used to create or submit data. PUT is generally used to replace a resource. PATCH is generally used to partially update a resource. DELETE is generally used to remove a resource.

Example

Node.js Example
GET     /users
POST    /users
PUT     /users/1
PATCH   /users/1
DELETE  /users/1

Output

The HTTP methods represent common CRUD operations.

Practice

Design HTTP routes for creating, reading, updating, and deleting products.

Interview Questions

1.

What is the difference between PUT and PATCH?

2.

What is GET used for?

3.

What is DELETE used for?

Quick Quiz

Which option best matches this chapter?

A.GET, POST, PUT, PATCH and DELETE
B.HTML, CSS and SQL
C.TCP, UDP and DNS
D.React, Vue and Angular

Answer: GET, POST, PUT, PATCH and DELETE