cache-control extension example

This commit is contained in:
Lloyd Brookes
2016-05-30 13:48:45 +01:00
parent 1c57d29b3f
commit 6a2bbafd08
4 changed files with 20 additions and 13 deletions

17
extend/cache-control.js Normal file
View File

@ -0,0 +1,17 @@
'use strict'
const Koa = require('koa')
const localWebServer = require('../')
const cacheControl = require('koa-cache-control')
const convert = require('koa-convert')
const app = new Koa()
const ws = localWebServer({
'no-cache': true,
log: { format: 'dev' }
})
app.use(convert(cacheControl({
maxAge: 15
})))
app.use(ws)
app.listen(8000)