change 'prod' to 'production',

This commit is contained in:
2018-06-03 14:41:04 +03:00
parent d7656f9715
commit 3cc1aa5475
3 changed files with 7 additions and 7 deletions

2
app.js
View File

@@ -28,7 +28,7 @@ const auth = require('./routes/auth');
app.use('/api/lists', auth.required, require('./routes/lists')); app.use('/api/lists', auth.required, require('./routes/lists'));
app.use('/api/todos', auth.required, require('./routes/todos')); app.use('/api/todos', auth.required, require('./routes/todos'));
if (process.env.NODE_ENV === 'prod') { if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, 'react/build'))); app.use(express.static(path.join(__dirname, 'react/build')));
app.use('*', express.static(path.join(__dirname, 'react/build/index.html'))); app.use('*', express.static(path.join(__dirname, 'react/build/index.html')));
} }

View File

@@ -1,6 +1,6 @@
const env = process.env.NODE_ENV; const env = process.env.NODE_ENV;
const prod = { const production = {
app: { app: {
port: process.env.PORT, port: process.env.PORT,
}, },
@@ -10,7 +10,7 @@ const prod = {
secret: process.env.SECRET, secret: process.env.SECRET,
}; };
const dev = { const development = {
app: { app: {
port: process.env.DEV_PORT || 4000, port: process.env.DEV_PORT || 4000,
}, },
@@ -25,9 +25,9 @@ const test = {
}; };
const config = { const config = {
prod, production,
dev, development,
test, test,
}; };
module.exports = config[env] || config.prod; module.exports = config[env] || config.production;

View File

@@ -6,7 +6,7 @@
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"start": "node ./app.js", "start": "node ./app.js",
"debug": "cross-env NODE_ENV=dev npx nodemon --inspect ./app.js", "debug": "cross-env NODE_ENV=development npx nodemon --inspect ./app.js",
"test": "cross-env NODE_ENV=test jest", "test": "cross-env NODE_ENV=test jest",
"postinstall": "cd react && npm install && npm run build" "postinstall": "cd react && npm install && npm run build"
}, },