|
@ -1,13 +1,14 @@ |
|
|
'use strict' |
|
|
'use strict' |
|
|
const LocalWebServer = require('../') |
|
|
|
|
|
|
|
|
const LocalWebServer = require('../../') |
|
|
const cacheControl = require('koa-cache-control') |
|
|
const cacheControl = require('koa-cache-control') |
|
|
|
|
|
|
|
|
const optionDefinitions = { name: 'maxage', type: Number, defaultValue: 1000 } |
|
|
|
|
|
|
|
|
|
|
|
const ws = new LocalWebServer() |
|
|
const ws = new LocalWebServer() |
|
|
ws.addLogging('dev') |
|
|
ws.addLogging('dev') |
|
|
.add({ |
|
|
.add({ |
|
|
optionDefinitions: optionDefinitions, |
|
|
|
|
|
|
|
|
optionDefinitions: { |
|
|
|
|
|
name: 'maxage', type: Number, |
|
|
|
|
|
description: 'The maxage to set on each response.' |
|
|
|
|
|
}, |
|
|
middleware: function (options) { |
|
|
middleware: function (options) { |
|
|
return cacheControl({ maxAge: options.maxage }) |
|
|
return cacheControl({ maxAge: options.maxage }) |
|
|
} |
|
|
} |