middleware

The think.middleware.base class inherit from think.http.base

Inheritence with ES6:

export default class extends think.middleware.base {
  run(){

  }
}

Dynamic Creating Class

module.exports = think.middleware({
  run: function(){

  }
})

Methods

middleare.run()

  • return {Promise}

middleware exported entrance, invoke this function when calling middleware.