Welcome to the Treehouse Community
Looking to learn something new?
How does express determine the 'next' parameter to pass into each middleware function?
I'm curious as to how express knows what to pass as each next parameter. Is this simply done in order of app.use() functions, or is there more to it?
Tom Geraghty24,162 Points
The next parameter is a callback function. It's called next by convention to make writing and reading applications using this convention easier.
If you think in Promises, you can think of this particular callback as being called when the Promise has been resolved and the program is free to move on to the next step in processing the application's logic.