Complete the code to use the HTTP method for creating a new resource.
app.[1]('/items', (req, res) => { res.send('Create item'); });
The POST method is used to create new resources on the server.
Complete the code to use the HTTP method for reading a resource.
app.[1]('/items/:id', (req, res) => { res.send('Read item'); });
The GET method is used to read or retrieve data from the server.
Fix the error in the code by choosing the correct HTTP method for updating a resource.
app.[1]('/items/:id', (req, res) => { res.send('Update item'); });
The PUT method is used to update an existing resource completely.
Fill both blanks to handle partial updates and deletions of a resource.
app.[1]('/items/:id', (req, res) => { res.send('Partial update'); }); app.[2]('/items/:id', (req, res) => { res.send('Delete item'); });
PATCH is used for partial updates, and DELETE is used to remove resources.
Fill all three blanks to complete the CRUD operations with correct HTTP methods.
app.[1]('/items', (req, res) => { res.send('Create item'); }); app.[2]('/items/:id', (req, res) => { res.send('Read item'); }); app.[3]('/items/:id', (req, res) => { res.send('Delete item'); });
POST creates, GET reads, and DELETE removes resources in REST APIs.
