You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
428 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. 'use strict'
  2. const LocalWebServer = require('../')
  3. const cacheControl = require('koa-cache-control')
  4. const optionDefinitions = { name: 'maxage', type: Number, defaultValue: 1000 }
  5. const ws = new LocalWebServer()
  6. ws.addLogging('dev')
  7. .add({
  8. optionDefinitions: optionDefinitions,
  9. middleware: function (options) {
  10. return cacheControl({ maxAge: options.maxage })
  11. }
  12. })
  13. .addStatic()
  14. .addIndex()
  15. .start()