From be80f95278bd5b6161e51b6c39f3231e786664a3 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 12 May 2017 23:24:00 +0430 Subject: [PATCH] middleware ~> serverMiddleware To avoid confuse between client and serverSide middlewares --- lib/module.js | 4 ++-- lib/nuxt.js | 2 +- lib/server.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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) {