Experimenting with using compress() in production.

This commit is contained in:
Nick Winter 2014-03-03 16:19:35 -08:00
parent c944e78271
commit df95e8c784
2 changed files with 5 additions and 1 deletions

View file

@ -261,7 +261,7 @@ module.exports = class Handler
tv4 = require('tv4').tv4
res = tv4.validateMultiple(input, @jsonSchema)
res
@isID: (id) -> _.isString(id) and id.length is 24 and id.match(/[a-z0-9]/gi)?.length is 24
getDocumentForIdOrSlug: (idOrSlug, done) ->

View file

@ -47,6 +47,8 @@ setupExpressMiddleware = (app) ->
app.use(express.bodyParser())
app.use(express.methodOverride())
app.use(express.cookieSession({secret:'defenestrate'}))
if config.isProduction
app.use(express.compress())
setupPassportMiddleware = (app) ->
app.use(authentication.initialize())
@ -115,3 +117,5 @@ exports.setExpressConfigurationOptions = (app) ->
app.set('views', __dirname + '/app/views')
app.set('view engine', 'jade')
app.set('view options', { layout: false })
app.set('env', if config.isProduction then 'production' else 'development')
app.set('json spaces', 0)