It would be interesting to cover async behaviour and issue like: what to do if a middleware call next when the following 2 other middleware already runs?
Full Stack Software Engineer with years of professional experience with JavaScript ecosystem. On my free time, I maintain a few open-source libraries and tools for solving various problems.
Good explanation!
It would be interesting to cover async behaviour and issue like: what to do if a middleware call
next
when the following 2 other middleware already runs?Each
next
function is supposed to be called only 1 time.If you call it twice then, you get the
Error('next() called multiple times')
error.Also, if you're using async middleware functions, you should always do
await next()
.