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.

18 lines
434 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 ws = new LocalWebServer()
  5. ws.addLogging('dev')
  6. .add({
  7. optionDefinitions: {
  8. name: 'maxage', type: Number,
  9. description: 'The maxage to set on each response.'
  10. },
  11. middleware: function (options) {
  12. return cacheControl({ maxAge: options.maxage })
  13. }
  14. })
  15. .addStatic()
  16. .addIndex()
  17. .start()