Browse Source

default-stack module

master
Lloyd Brookes 8 years ago
parent
commit
22bc5df12c
  1. 17
      lib/command/middleware-list.js
  2. 17
      lib/command/serve.js
  3. 16
      lib/default-stack.js
  4. 17
      lib/local-web-server.js
  5. 2
      package.json

17
lib/command/middleware-list.js

@ -3,22 +3,7 @@ class MiddlewareList {
return 'Print available middleware' return 'Print available middleware'
} }
execute (options) { execute (options) {
const list = [
'lws-request-monitor',
'lws-log',
'lws-cors',
'lws-json',
'lws-rewrite',
'lws-body-parser',
'lws-blacklist',
'lws-conditional-get',
'lws-mime',
'lws-compress',
'lws-mock-response',
'lws-spa',
'lws-static',
'lws-index'
]
const list = require('../default-stack')
console.log(list) console.log(list)
} }
} }

17
lib/command/serve.js

@ -13,22 +13,7 @@ class WsServe extends ServeCommand {
.set('av', require('../../package').version) .set('av', require('../../package').version)
.set('cd4', 'cli') .set('cd4', 'cli')
options = { options = {
stack: [
'lws-request-monitor',
'lws-log',
'lws-cors',
'lws-json',
'lws-rewrite',
'lws-body-parser',
'lws-blacklist',
'lws-conditional-get',
'lws-mime',
'lws-compress',
'lws-mock-response',
'lws-spa',
'lws-static',
'lws-index'
],
stack: require('../default-stack'),
moduleDir: path.resolve(__dirname, `../../node_modules`), moduleDir: path.resolve(__dirname, `../../node_modules`),
modulePrefix: 'lws-' modulePrefix: 'lws-'
} }

16
lib/default-stack.js

@ -0,0 +1,16 @@
module.exports = [
'lws-body-parser',
'lws-request-monitor',
'lws-log',
'lws-cors',
'lws-json',
'lws-rewrite',
'lws-blacklist',
'lws-conditional-get',
'lws-mime',
'lws-compress',
'lws-mock-response',
'lws-spa',
'lws-static',
'lws-index'
]

17
lib/local-web-server.js

@ -11,22 +11,7 @@ class LocalWebServer extends Lws {
options = Object.assign({ options = Object.assign({
moduleDir: path.resolve(__dirname, `../node_modules`), moduleDir: path.resolve(__dirname, `../node_modules`),
modulePrefix: 'lws-', modulePrefix: 'lws-',
stack: [
'lws-request-monitor',
'lws-log',
'lws-cors',
'lws-json',
'lws-rewrite',
'lws-body-parser',
'lws-blacklist',
'lws-conditional-get',
'lws-mime',
'lws-compress',
'lws-mock-response',
'lws-spa',
'lws-static',
'lws-index'
]
stack: require('./default-stack')
}, options) }, options)
return super.create(options) return super.create(options)
} }

2
package.json

@ -42,7 +42,7 @@
"lws-json": "^0.3.2", "lws-json": "^0.3.2",
"lws-log": "^0.3.0", "lws-log": "^0.3.0",
"lws-mime": "^0.2.1", "lws-mime": "^0.2.1",
"lws-mock-response": "^0.2.3",
"lws-mock-response": "^0.2.4",
"lws-request-monitor": "^0.1.0", "lws-request-monitor": "^0.1.0",
"lws-rewrite": "^0.3.4", "lws-rewrite": "^0.3.4",
"lws-spa": "^0.2.2", "lws-spa": "^0.2.2",

Loading…
Cancel
Save