middleware ~> serverMiddleware

To avoid confuse between client and serverSide middlewares
This commit is contained in:
Pooya Parsa 2017-05-12 23:24:00 +04:30
parent 975e468388
commit be80f95278
3 changed files with 4 additions and 4 deletions

View File

@ -59,8 +59,8 @@ class Module {
}) })
} }
addMiddleware (middleware) { addServerMiddleware (middleware) {
this.options.middlewares.push(middleware) this.options.serverMiddlewares.push(middleware)
} }
extendBuild (fn) { extendBuild (fn) {

View File

@ -28,7 +28,7 @@ class Nuxt {
plugins: [], plugins: [],
css: [], css: [],
modules: [], modules: [],
middlewares: [], serverMiddlewares: [],
cache: false, cache: false,
loading: { loading: {
color: 'black', color: 'black',

View File

@ -10,7 +10,7 @@ class Server {
this.app = connect() this.app = connect()
this.server = http.createServer(this.app) this.server = http.createServer(this.app)
// Add Middlewares // Add Middlewares
this.nuxt.options.middlewares.forEach(m => { this.nuxt.options.serverMiddlewares.forEach(m => {
if (m instanceof Function) { if (m instanceof Function) {
this.app.use(m) this.app.use(m)
} else if (m && m.path && m.handler) { } else if (m && m.path && m.handler) {