Possible error in the logical flow of the middleware sub-stack example provided in the website.
Description
Expectations
I could be wrong but i think you need to either remove the bang in front of req.headers['x-auth'] or swap next('route') with next().
Hi @Nishant-Dwivedi , thanks for suggesting. I think the current logic is correct though — the ! is intentional because we want to block requests that are missing the x-auth header.
Also, we use next('router') to skip the rest of the router if the header is missing, so it falls through to the 401 handler.
I think we need to improve our documentation on next().
Cc @expressjs/docs-wg
Hey @ShubhamOulkar, don't ping the TC when it's not necessary, that's what the documentation group is for. The ping to the TC is for organizational administrative matters.
I'll read this issue later, I have work to do.