Generic async middleware, handles a stack (or pipeline) of functions that
to pass along and possibly modify state for a final piece of functionality.
Similar to Express middleware, every middleware piece receives the same API
signature of state, next, and done. Each piece can either continue
the chain (by calling next) or interrupt the chain (by calling done).
If all middleware continues, a complete function is called to handle the
final state.
Middleware may wrap the done function to allow executing code in the second
half of the process (after complete has been executed).
Different kinds of middleware may receive different information in the state
object. For more details, see the API for each type of middleware.
Generic async middleware, handles a stack (or pipeline) of functions that to pass along and possibly modify state for a final piece of functionality.
Similar to Express middleware, every middleware
piece
receives the same API signature ofstate
,next
, anddone
. Each piece can either continue the chain (by calling next) or interrupt the chain (by calling done). If all middleware continues, acomplete
function is called to handle the final state.Middleware may wrap the
done
function to allow executing code in the second half of the process (aftercomplete
has been executed).Different kinds of middleware may receive different information in the state object. For more details, see the API for each type of middleware.