extend examples

This commit is contained in:
Lloyd Brookes
2016-06-18 10:29:34 +01:00
parent aee47bc599
commit 6298f693cd
8 changed files with 39 additions and 10 deletions

View File

@ -0,0 +1,3 @@
{
"maxage": 2000
}

View File

@ -0,0 +1,18 @@
'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()
.start()