extend examples
This commit is contained in:
3
extend/cache-control/.local-web-server.json
Normal file
3
extend/cache-control/.local-web-server.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"maxage": 2000
|
||||
}
|
18
extend/cache-control/server.js
Normal file
18
extend/cache-control/server.js
Normal 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()
|
Reference in New Issue
Block a user