diff --git a/lib/module.js b/lib/module.js index 1c12eca898..4aa812b128 100755 --- a/lib/module.js +++ b/lib/module.js @@ -59,8 +59,8 @@ class Module { }) } - addMiddleware (middleware) { - this.options.middlewares.push(middleware) + addServerMiddleware (middleware) { + this.options.serverMiddlewares.push(middleware) } extendBuild (fn) { diff --git a/lib/nuxt.js b/lib/nuxt.js index 7604ddeb47..2cfc044772 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -28,7 +28,7 @@ class Nuxt { plugins: [], css: [], modules: [], - middlewares: [], + serverMiddlewares: [], cache: false, loading: { color: 'black', diff --git a/lib/server.js b/lib/server.js index c250c44301..cf9853e1a1 100644 --- a/lib/server.js +++ b/lib/server.js @@ -10,7 +10,7 @@ class Server { this.app = connect() this.server = http.createServer(this.app) // Add Middlewares - this.nuxt.options.middlewares.forEach(m => { + this.nuxt.options.serverMiddlewares.forEach(m => { if (m instanceof Function) { this.app.use(m) } else if (m && m.path && m.handler) {