Каркас будущего приложения
This commit is contained in:
@@ -2,7 +2,7 @@ const path = require('path');
|
||||
const pckg = require('../../package.json');
|
||||
|
||||
const execDir = path.resolve(__dirname, '..');
|
||||
const dataDir = `${execDir}/.${pckg.name}/data`;
|
||||
const dataDir = `${execDir}/.${pckg.name}`;
|
||||
|
||||
module.exports = {
|
||||
branch: 'unknown',
|
||||
|
||||
@@ -3,7 +3,7 @@ const pckg = require('../../package.json');
|
||||
const base = require('./base');
|
||||
|
||||
const execDir = path.dirname(process.execPath);
|
||||
const dataDir = `${execDir}/.${pckg.name}/data`;
|
||||
const dataDir = `${execDir}/.${pckg.name}`;
|
||||
|
||||
module.exports = Object.assign({}, base, {
|
||||
branch: 'production',
|
||||
|
||||
@@ -20,7 +20,7 @@ function webpackDevMiddleware(app) {
|
||||
function logQueries(app) {
|
||||
app.use(function(req, res, next) {
|
||||
const start = Date.now();
|
||||
log(`${req.method} ${req.originalUrl} ${JSON.stringify(req.body).substr(0, 4000)}`);
|
||||
log(`${req.method} ${req.originalUrl} ${JSON.stringify(req.body ? req.body : '').substr(0, 4000)}`);
|
||||
//log(`${JSON.stringify(req.headers, null, 2)}`)
|
||||
res.once('finish', () => {
|
||||
log(`${Date.now() - start}ms`);
|
||||
|
||||
@@ -105,6 +105,17 @@ async function main() {
|
||||
function initStatic(app, config) {// eslint-disable-line
|
||||
//загрузка файлов в /files
|
||||
//TODO
|
||||
|
||||
app.use(express.static(config.publicDir, {
|
||||
maxAge: '30d',
|
||||
|
||||
/*setHeaders: (res, filePath) => {
|
||||
if (path.dirname(filePath) == filesDir) {
|
||||
res.set('Content-Type', 'application/xml');
|
||||
res.set('Content-Encoding', 'gzip');
|
||||
}
|
||||
},*/
|
||||
}));
|
||||
}
|
||||
|
||||
(async() => {
|
||||
|
||||
Reference in New Issue
Block a user