Reputation: 22957
I have a simple module that authenticates. If the user is not authenticated I use this function to move him forward :
function forbidden() {
return next({ status: 403 });
}
I can't seem to find what's the next
function that picks this up in case of 403
. Is there a way I can see all the middleware stack ?
Thanks
Upvotes: 0
Views: 46
Reputation: 146074
next
is always a synthetic function that connect creates to know when your middleware is done and it's time to proceed either down the regular middleware stack (if no error is passed to next
) or the error handling middleware stack (when an error is passed to next
as in your example). So it's always going to be the same function, but you can explore with node-inspector if you want to peek at the state of the connect middleware stack for educational purposes. Even then since most functions added to the connect middleware are coded as anonymous functions, the middleware stack Array is just going to look like [Function, Function, Function]
and not be very illuminating.
Upvotes: 1