0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00
This commit is contained in:
Trevor Buckner
2020-11-11 21:41:48 -05:00
parent 600ca90fc0
commit 759d986188

View File

@@ -8,21 +8,13 @@ const homebrewApi = require('./server/homebrew.api.js');
const GoogleActions = require('./server/googleActions.js');
// Serve brotli-compressed static files if available
app.get('*.js', function(req, res, next) {
if(fs.existsSync('build' + req.url + '.br')){
req.url = req.url + '.br';
app.get(['*.js', '*.css'], function(req, res, next) {
if(fs.existsSync(`build${req.url}.br`)){
req.url = `${req.url}.br`;
res.set('Content-Encoding', 'br');
res.set('Content-Type', 'text/javascript');
}
next();
});
app.get('*.css', function(req, res, next) {
if(fs.existsSync('build' + req.url + '.br')){
req.url = req.url + '.br';
res.set('Content-Encoding', 'br');
res.set('Content-Type', 'text/javascript');
}
next();
next();
});
app.use(express.static(`${__dirname}/build`));
@@ -63,14 +55,9 @@ app.use((req, res, next)=>{
return next();
});
app.use(homebrewApi);
app.use(require('./server/admin.api.js'));
//app.use('/user',require('./server/user.routes.js'));
const HomebrewModel = require('./server/homebrew.model.js').model;
const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
const changelogText = require('fs').readFileSync('./changelog.md', 'utf8');
@@ -219,11 +206,6 @@ app.get('/print/:id', (req, res, next)=>{
}
});
app.get('/source/:id', (req, res)=>{
});
//Render the page
//const render = require('.build/render');
const templateFn = require('./client/template.js');