diff --git a/src/server/interfaces/Endpoint.js b/src/server/interfaces/Endpoint.js index e032890..8067fd1 100644 --- a/src/server/interfaces/Endpoint.js +++ b/src/server/interfaces/Endpoint.js @@ -28,9 +28,9 @@ class Endpoint { init () { - for (const [ method, cb ] of this.methods) { + for (const [ method, cb, mw = [] ] of this.methods) { if (typeof method !== 'string') throw new Error(`Invalid method parameter type in Endpoint ${this.name} major path`); - this.client.app[method](this.path, ...this.middleware, cb); + this.client.app[method](this.path, ...this.middleware, ...mw, cb); } this.subpaths = [ ...this._subpaths, ...this.subpaths ];