0
0
Node.jsframework~20 mins

HTTP methods and CRUD mapping in Node.js - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
HTTP CRUD Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Mapping HTTP methods to CRUD operations

Which HTTP method is correctly paired with the Update operation in CRUD?

APUT
BPOST
CGET
DDELETE
Attempts:
2 left
💡 Hint

Think about which method replaces or modifies existing data.

component_behavior
intermediate
2:00remaining
Behavior of HTTP DELETE method

What is the expected behavior when a server receives an HTTP DELETE request for a resource?

AThe server creates a new resource.
BThe server removes the specified resource.
CThe server retrieves the resource data.
DThe server updates the resource partially.
Attempts:
2 left
💡 Hint

DELETE is about removing something.

📝 Syntax
advanced
2:00remaining
Correct HTTP method for partial update

Which HTTP method is designed for partial updates of a resource?

APATCH
BPUT
CPOST
DGET
Attempts:
2 left
💡 Hint

It modifies only parts of a resource, not the whole.

state_output
advanced
2:00remaining
Result of GET request on a resource

What is the typical result of a successful HTTP GET request to a resource endpoint?

AA new resource is created and its ID is returned.
BThe resource is updated with new data.
CThe resource data is returned without modifying it.
DThe resource is deleted and a confirmation is returned.
Attempts:
2 left
💡 Hint

GET is used to read data, not change it.

🔧 Debug
expert
3:00remaining
Identify the incorrect HTTP method for Create operation

Which HTTP method is incorrectly used for creating a new resource?

Node.js
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');
});
AGET is used to create a new resource, which is incorrect.
BPOST is the correct method to create a new resource.
CPUT can be used to create a resource but only at a specific URL.
DPUT used without specifying resource ID is incorrect for creation.
Attempts:
2 left
💡 Hint

PUT on a collection endpoint like /items is incorrect for creation.