mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Enable caching of static assets (#1217)
* Enable caching of static assets * Remove dependency on mime package Since we only care about two file extensions at the moment, there is no need to grab the whole package just to avoid calling 'endsWith' twice.
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
const _ = require('lodash');
|
||||
const jwt = require('jwt-simple');
|
||||
const expressStaticGzip = require('express-static-gzip');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
const homebrewApi = require('./server/homebrew.api.js');
|
||||
const GoogleActions = require('./server/googleActions.js');
|
||||
const serveCompressedStaticAssets = require('./server/static-assets.mv.js');
|
||||
|
||||
// Serve brotli-compressed static files if available
|
||||
app.use('/', expressStaticGzip(`${__dirname}/build`, {
|
||||
enableBrotli : true,
|
||||
orderPreference : ['br'],
|
||||
index : false
|
||||
}));
|
||||
app.use('/', serveCompressedStaticAssets(`${__dirname}/build`));
|
||||
|
||||
process.chdir(__dirname);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user