Answer the question
In order to leave comments, you need to log in
When is next() used in Express?
According to the documentation - in order to proceed to the processing of the next controller mmm chtoli ...
That is, there it is like this:
req.get("/", function (req, res, next) {
// ... code
next();
}, function (req, res) {
// ... code
});
Answer the question
In order to leave comments, you need to log in
Here we are not talking about "controllers", but about middleware . And in this context, the call chain becomes clear. For example:
The main reason for this architecture is an attempt to get rid of callback-hell. In Express, everything is on callbacks, which are poorly adapted to asynchrony, in fact. So they came up with such "promises for the poor" (here I greatly simplified, of course).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question