* Use the given middleware `fn`. * * Old-style middleware will be converted. * * @param {(context: Context) => Promise<any | void>} fn * @return {Application} self * @api public
(fn)
| 150 | */ |
| 151 | |
| 152 | use (fn) { |
| 153 | if (typeof fn !== class="st">'function') { throw new TypeError(class="st">'middleware must be a function!') } |
| 154 | debug(class="st">'use %s', fn._name || fn.name || class="st">'-') |
| 155 | this.middleware.push(fn) |
| 156 | return this |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Return a request handler callback |
no outgoing calls