diff --git a/example/custom/cache-control/.local-web-server.json b/example/custom/cache-control/.local-web-server.json deleted file mode 100644 index 89cb0a2..0000000 --- a/example/custom/cache-control/.local-web-server.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "maxage": 2000 -} diff --git a/example/custom/cache-control/server.js b/example/custom/cache-control/server.js deleted file mode 100644 index f72e532..0000000 --- a/example/custom/cache-control/server.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' -const LocalWebServer = require('../../') -const cacheControl = require('koa-cache-control') - -const ws = new LocalWebServer() -ws.addLogging('dev') - .add({ - optionDefinitions: { - name: 'maxage', type: Number, - description: 'The maxage to set on each response.' - }, - middleware: function (options) { - return cacheControl({ maxAge: options.maxage }) - } - }) - .addStatic() - .addIndex() - .listen() diff --git a/example/custom/live-reload-optional/server.js b/example/custom/live-reload-optional/server.js deleted file mode 100644 index 7c48b99..0000000 --- a/example/custom/live-reload-optional/server.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' -const Cli = require('../../') -const liveReload = require('koa-livereload') - -const ws = new Cli() -ws.addLogging('dev') - .add({ - optionDefinitions: { - name: 'live-reload', type: Boolean, - description: 'Add live reload.' - }, - middleware: function (options) { - if (options['live-reload']) { - return liveReload() - } - } - }) - .addStatic() - .listen() diff --git a/example/custom/live-reload/server.js b/example/custom/live-reload/server.js deleted file mode 100644 index 9f2a00e..0000000 --- a/example/custom/live-reload/server.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict' -const Cli = require('../../') -const liveReload = require('koa-livereload') - -const ws = new Cli() -ws.addLogging('dev') - .add({ middleware: liveReload }) - .addStatic() - .listen() diff --git a/example/stack/cache-control.js b/example/stack/cache-control.js index 52863aa..074a52e 100644 --- a/example/stack/cache-control.js +++ b/example/stack/cache-control.js @@ -5,19 +5,23 @@ const DefaultStack = require('local-web-server-default-stack') class CacheControl extends DefaultStack { addAll () { - this.addLogging('dev') - .add({ - optionDefinitions: { - name: 'maxage', type: Number, - description: 'The maxage to set on each response.' - }, - middleware: function (options) { - return cacheControl({ maxAge: options.maxage }) - } - }) + return this.addLogging('dev') + .addCacheControl() .addStatic() .addIndex() } + addCacheControl () { + this.add({ + optionDefinitions: { + name: 'maxage', type: Number, + description: 'The maxage to set on each response.' + }, + middleware: function (options) { + return cacheControl({ maxAge: options.maxage }) + } + }) + return this + } } module.exports = CacheControl diff --git a/example/custom/live-reload/index.html b/example/stack/live-reload-optional/index.html similarity index 73% rename from example/custom/live-reload/index.html rename to example/stack/live-reload-optional/index.html index 0cc6591..f467990 100644 --- a/example/custom/live-reload/index.html +++ b/example/stack/live-reload-optional/index.html @@ -5,6 +5,6 @@