Answer the question
In order to leave comments, you need to log in
Is an intermediate event handler also middleware or not?
It is clear what midlware is, this is the code that is executed between the request and the response, it has access to the request and response object, etc. but in the code I once met a code like this
app.get('/', (req, res, next) =>)
// to do
next(err)
app.use(...)
?
Answer the question
In order to leave comments, you need to log in
Nothing, it's all middleware. The essence of the intermediate handler is that it must be called at the very end and either terminate the process or pass req / res objects to the next intermediate state.
Here you can see the implementation inside express, and here you can read how the whole thing works
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question