August 2017
Beginner
374 pages
10h 41m
English
Now, we need to define the use method, which takes a middleware function as an argument and adds it to the middleware chain:
use (fn) {
const previousFn = this.middleware
this.middleware = (next) =>
previousFn.call(this, () =>
fn.call(this, next) ) }
Read now
Unlock full access