2016-05-30 13:48:45 +01:00
|
|
|
'use strict'
|
2016-06-18 10:29:34 +01:00
|
|
|
const LocalWebServer = require('../../')
|
2016-05-30 13:48:45 +01:00
|
|
|
const cacheControl = require('koa-cache-control')
|
|
|
|
|
2016-06-15 21:02:52 +01:00
|
|
|
const ws = new LocalWebServer()
|
2016-06-16 23:00:07 +01:00
|
|
|
ws.addLogging('dev')
|
|
|
|
.add({
|
2016-06-18 10:29:34 +01:00
|
|
|
optionDefinitions: {
|
|
|
|
name: 'maxage', type: Number,
|
|
|
|
description: 'The maxage to set on each response.'
|
|
|
|
},
|
2016-06-16 23:00:07 +01:00
|
|
|
middleware: function (options) {
|
2016-06-18 10:13:27 +01:00
|
|
|
return cacheControl({ maxAge: options.maxage })
|
2016-06-16 23:00:07 +01:00
|
|
|
}
|
|
|
|
})
|
2016-06-09 22:54:57 +01:00
|
|
|
.addStatic()
|
|
|
|
.addIndex()
|
2016-06-16 23:00:07 +01:00
|
|
|
.start()
|