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 Express Basics (2015) Doing more with Express Using “express-generator” to Start an Express Project

Hamza Hajji
Hamza Hajji
11,931 Points

I know the req and res stand for request and response but what does the 'next' paramater mean ?!

can somebody please explain ?

1 Answer

Steven Parker
Steven Parker
231,269 Points

Paraphrasing the Express Guide:

Middleware functions have access to the request object (req), the response object (res), and the next middleware function in the application’s request-response cycle. If the current middleware function does not end the request-response cycle, it must call next() to pass control to the next middleware function. Otherwise, the request will be left hanging.

Follow the link above for more detail and examples.