Updating a Resource - PATCH /todos/:id

The delete route is now set up and tested, so it's time to start on the final route for managing our Todo resources. This is going to be the route that lets you update a Todo item whether you want to change the text to something else or whether you want to toggle it as completed. Now this is going to be the most complex route we write; everything so far has been relatively straightforward. We're going to need to do a few extra things to get this updating route to work as expected.

The first thing I want to do before we go ahead and create the route down below is install that Lodash library we used in one of the previous sections for this course.

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.