mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 20:42:44 +00:00
lint
This commit is contained in:
26
server.js
26
server.js
@@ -8,21 +8,13 @@ const homebrewApi = require('./server/homebrew.api.js');
|
|||||||
const GoogleActions = require('./server/googleActions.js');
|
const GoogleActions = require('./server/googleActions.js');
|
||||||
|
|
||||||
// Serve brotli-compressed static files if available
|
// Serve brotli-compressed static files if available
|
||||||
app.get('*.js', function(req, res, next) {
|
app.get(['*.js', '*.css'], function(req, res, next) {
|
||||||
if(fs.existsSync('build' + req.url + '.br')){
|
if(fs.existsSync(`build${req.url}.br`)){
|
||||||
req.url = req.url + '.br';
|
req.url = `${req.url}.br`;
|
||||||
res.set('Content-Encoding', 'br');
|
res.set('Content-Encoding', 'br');
|
||||||
res.set('Content-Type', 'text/javascript');
|
res.set('Content-Type', 'text/javascript');
|
||||||
}
|
}
|
||||||
next();
|
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();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(express.static(`${__dirname}/build`));
|
app.use(express.static(`${__dirname}/build`));
|
||||||
@@ -63,14 +55,9 @@ app.use((req, res, next)=>{
|
|||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.use(homebrewApi);
|
app.use(homebrewApi);
|
||||||
|
|
||||||
app.use(require('./server/admin.api.js'));
|
app.use(require('./server/admin.api.js'));
|
||||||
|
|
||||||
//app.use('/user',require('./server/user.routes.js'));
|
|
||||||
|
|
||||||
|
|
||||||
const HomebrewModel = require('./server/homebrew.model.js').model;
|
const HomebrewModel = require('./server/homebrew.model.js').model;
|
||||||
const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
|
const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
|
||||||
const changelogText = require('fs').readFileSync('./changelog.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
|
//Render the page
|
||||||
//const render = require('.build/render');
|
//const render = require('.build/render');
|
||||||
const templateFn = require('./client/template.js');
|
const templateFn = require('./client/template.js');
|
||||||
|
|||||||
Reference in New Issue
Block a user