Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build a REST API With Express Completing and Testing the API Test Routes with Postman

Dave Degeatano
Dave Degeatano
2,267 Points

Why don't we use the `next` parameter in the callback functions for the router `put` and `delete` methods?

We pass next in our GET and POST requests, and then call them in the callback functions but we don't do the same for the PUT and DELETE methods.

nico dev
nico dev
20,364 Points

Excellent question! I was wondering the exact same thing.

Honestly hope someone will answer this one, since I can't find any explanation, at least not in the docs.

I think the point of the next is that you need it for the error handler with the conditional inside, right?

1 Answer

Zack Lee
Zack Lee
Courses Plus Student 17,662 Points

I'm fairly certain its because theres nothing to pass on after these action. PUT sends new data, and DELETE just removes data, therefore theres nothing returning to be passed on. This is just my thoughts on the issue, I'm not sure this is the actual case.