class Express {
response = {}
middles = []
use = func => this.middles.push(func)
get = () => {
this.middles.forEach(func => func(this.response))
console.log('RESPONSE NOW: ',this.response)
}
}
app = new Express()
app.get()
// response: {}
function addBla(res) { res.bla = 17 }
// миддлвар добавляет какое-то свойство в response от сервера
app.use(addBla)
app.get()
// response: {bla: 17}