diff --git a/lib/Server.js b/lib/Server.js index 2a2f6b1baf..07fcb6e8f3 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -2375,10 +2375,6 @@ class Server { }); } - if (typeof this.options.onAfterSetupMiddleware === "function") { - this.options.onAfterSetupMiddleware(this); - } - if (typeof this.options.setupMiddlewares === "function") { middlewares = this.options.setupMiddlewares(middlewares, this); } @@ -2395,6 +2391,10 @@ class Server { (this.app).use(middleware.middleware); } }); + + if (typeof this.options.onAfterSetupMiddleware === "function") { + this.options.onAfterSetupMiddleware(this); + } } /**