July 2018
Beginner
100 pages
2h 7m
English
Now that we have almost updated all our routes that we had from Chapter 2, Building the API – Part 1, let's now remove all the code that is no longer needed:
const todoList = [...];
{ method: 'PUT', path: '/todo/{id}', handler: (request, reply) => { const index = request.params.id - 1; // replace the whole resource with the new one todoList[index] = request.payload; return reply({ message: 'updated' }); },},
{ method: 'DELETE', path: '/todo/{id}', handler: async (request, reply) => { ...Read now
Unlock full access