Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,650 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.