Files
hiring-test-one/extend/cache-control.js

18 lines
439 B
JavaScript
Raw Normal View History

2016-05-30 13:48:45 +01:00
'use strict'
2016-06-15 21:02:52 +01:00
const LocalWebServer = require('../')
2016-05-30 13:48:45 +01:00
const cacheControl = require('koa-cache-control')
2016-06-16 23:00:07 +01:00
const optionDefinitions = { name: 'maxage', type: Number, defaultValue: 1000 }
2016-06-08 23:06:41 +01:00
2016-06-15 21:02:52 +01:00
const ws = new LocalWebServer()
2016-06-16 23:00:07 +01:00
ws.addLogging('dev')
.add({
optionDefinitions: optionDefinitions,
middleware: function (options) {
return cacheControl({ maxAge: options.middleware.maxage })
}
})
2016-06-09 22:54:57 +01:00
.addStatic()
.addIndex()
2016-06-16 23:00:07 +01:00
.start()