Skip to content

Latest commit

 

History

History
109 lines (75 loc) · 4.54 KB

api.md

File metadata and controls

109 lines (75 loc) · 4.54 KB

Classes

ConnectSequence

Typedefs

middlewareFilterBoolean

A middleware filter function run at the middleware runtime, causing the middleware or middleware list should be ran or skiped

ConnectSequence

Kind: global class

new ConnectSequence(req, res, next)

Param Type Description
req object The request object
res object The response object
next function The next middleware

connectSequence.run() ⇒ undefined

Run sequencially each appended middleware, using the next argument as the final callback.

Kind: instance method of ConnectSequence

connectSequence.append(...middlewares) ⇒ ConnectSequence

Append an arbitrary number of middlewares as an argument list

Kind: instance method of ConnectSequence
Returns: ConnectSequence - a reference to the instance to be chainable
Throws:

  • TypeError if one of the given middlewares is not a function. All the given middlewares would be rejected.
Param Type Description
...middlewares function A list of middleware functions (or errorHandler middlewares)

connectSequence.appendList(middlewares) ⇒ ConnectSequence

Append an arbitrary number of middlewares as an array

Kind: instance method of ConnectSequence
Returns: ConnectSequence - a reference to the instance to be chainable

Param Type Description
middlewares Array.<function()> An array of middleware functions (or errorHandler middlewares)

connectSequence.appendIf(filter, ...middlewares) ⇒ ConnectSequence

Append an arbitrary number of middlewares as an argument list if the filter pass at runtime of the first middleware in the given list

Kind: instance method of ConnectSequence
Returns: ConnectSequence - a reference to the instance to be chainable

Param Type Description
filter function A filter function (returning a Boolean)
...middlewares function A list of middleware functions (or errorHandler middlewares)

connectSequence.appendListIf(filter, middlewares) ⇒ ConnectSequence

Append an arbitrary number of middlewares as an array if the filter pass at runtime of the first middleware in the given list

Kind: instance method of ConnectSequence
Returns: ConnectSequence - a reference to the instance to be chainable

Param Type Description
filter middlewareFilter A filter function on the req object
middlewares Array.<function()> An array of middleware functions (or errorHandler middlewares)

middlewareFilter ⇒ Boolean

A middleware filter function run at the middleware runtime, causing the middleware or middleware list should be ran or skiped

Kind: global typedef

Param Type Description
req IncomingMessage The express request object