Browse Source

--no-cache option

master
Lloyd Brookes 9 years ago
parent
commit
01ba3676e5
  1. 3
      bin/cli.js
  2. 4
      lib/cli-options.js
  3. 3
      lib/local-web-server.js

3
bin/cli.js

@ -46,7 +46,8 @@ localWebServer({
mime: options.cli.server.mime, mime: options.cli.server.mime,
blacklist: options.cli.server.blacklist.map(regexp => RegExp(regexp, "i")), blacklist: options.cli.server.blacklist.map(regexp => RegExp(regexp, "i")),
proxyRoutes: options.cli.server.proxyRoutes, proxyRoutes: options.cli.server.proxyRoutes,
spa: options.cli.server.spa
spa: options.cli.server.spa,
'no-cache': options.cli.server['no-cache']
}).listen(options.cli.server.port, onServerUp) }).listen(options.cli.server.port, onServerUp)
function halt (message) { function halt (message) {

4
lib/cli-options.js

@ -17,6 +17,10 @@ module.exports = {
description: 'Enable gzip compression, reduces bandwidth.', group: 'server' description: 'Enable gzip compression, reduces bandwidth.', group: 'server'
}, },
{ {
name: 'no-cache', alias: 'n', type: Boolean,
description: 'Disable etag-based caching.', group: 'server'
},
{
name: 'help', alias: 'h', type: Boolean, name: 'help', alias: 'h', type: Boolean,
description: 'Print these usage instructions', group: 'misc' description: 'Print these usage instructions', group: 'misc'
}, },

3
lib/local-web-server.js

@ -83,8 +83,11 @@ function getApp (options) {
}) })
} }
/* Cache */
if (!options['no-cache']) {
app.use(conditional()) app.use(conditional())
app.use(etag()) app.use(etag())
}
/* mime-type overrides */ /* mime-type overrides */
if (options.mime) { if (options.mime) {

Loading…
Cancel
Save