default-stack module

This commit is contained in:
Lloyd Brookes
2017-07-05 12:49:26 +01:00
parent b1bc8bed96
commit 22bc5df12c
5 changed files with 20 additions and 49 deletions

View File

@ -3,22 +3,7 @@ class MiddlewareList {
return 'Print available middleware'
}
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)
}
}

View File

@ -13,22 +13,7 @@ class WsServe extends ServeCommand {
.set('av', require('../../package').version)
.set('cd4', 'cli')
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`),
modulePrefix: 'lws-'
}

16
lib/default-stack.js Normal file
View File

@ -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'
]

View File

@ -11,22 +11,7 @@ class LocalWebServer extends Lws {
options = Object.assign({
moduleDir: path.resolve(__dirname, `../node_modules`),
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)
return super.create(options)
}