Node.js Course
Node.js
/
Beginner

HTTP Methods

Definition

Standardized action verbs used in HTTP requests to indicate the desired operation to be performed on the target resource.

Explain Like I'm New

If the URL `/articles` is the noun, the HTTP Method is the verb. GET = Read. POST = Create. PUT = Completely Replace. PATCH = Partially Update. DELETE = Destroy.

Real World Example

When you type `google.com` into your browser and press enter, your browser ALWAYS sends a `GET` request. When you fill out a 'Sign Up' form and click submit, your browser usually sends a `POST` request containing your password hidden inside the request body.

Common Use Cases

  • •Building semantic RESTful APIs

Interactive Example

Loading...
Console output will appear here...

Interview Questions

basic

  • Which HTTP method is used to create new data?

intermediate

  • What is the difference between PUT and PATCH?

Flash Cards

Question

Which method to create?

Click to reveal answer
Answer

POST.

Question

PUT vs PATCH?

Click to reveal answer
Answer

PUT is a full replacement. If a user has {name, email, age} and you send a PUT with just {age: 30}, the name and email are wiped out. PATCH is a partial update. If you send a PATCH with {age: 30}, it ONLY updates the age and leaves the name and email intact.