Which HTTP method is correctly paired with the Update operation in CRUD?
Think about which method replaces or modifies existing data.
PUT is used to update or replace existing resources, matching the Update operation in CRUD.
What is the expected behavior when a server receives an HTTP DELETE request for a resource?
DELETE is about removing something.
DELETE requests instruct the server to remove the specified resource.
Which HTTP method is designed for partial updates of a resource?
It modifies only parts of a resource, not the whole.
PATCH is used for partial updates, unlike PUT which replaces the entire resource.
What is the typical result of a successful HTTP GET request to a resource endpoint?
GET is used to read data, not change it.
GET requests retrieve resource data without changing the server state.
Which HTTP method is incorrectly used for creating a new resource?
const express = require('express'); const app = express(); app.post('/items', (req, res) => { // Create new item logic res.status(201).send('Created'); }); app.get('/items', (req, res) => { // List items logic res.send('List'); }); app.put('/items', (req, res) => { // Intended to create new item but used PUT res.status(201).send('Created with PUT'); });
PUT on a collection endpoint like /items is incorrect for creation.
PUT is typically used for full replacement or conditional creation at a specific resource URL (e.g., /items/123). Using PUT on a collection endpoint like /items for creation is non-standard; POST is the standard method.