-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (34 loc) · 1.07 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* eslint no-console: 0, vars-on-top: 0 */
import express from 'express';
import getConfigSummary from './app/config/getConfigSummary';
import startServer from './app/server';
import './app/server/intl-polyfill';
const port = process.env.PORT || 3000;
const app = express();
console.log(getConfigSummary());
if (process.env.NODE_ENV === 'development') {
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
const webpackMiddleware = require('webpack-dev-middleware');
const webpackCompiler = webpack(webpackConfig);
app.use(webpackMiddleware(webpackCompiler, {
hot: true,
publicPath: webpackConfig.output.publicPath,
quiet: false,
noInfo: false,
stats: {
assets: false,
colors: true,
version: false,
hash: false,
timings: true,
chunks: false,
chunkModules: false,
},
}));
app.use(require('webpack-hot-middleware')(webpackCompiler));
}
startServer(app);
app.listen(port, () =>
console.log('\nServer is now listening to %s:%s...', process.env.HOST || 'localhost', port)
);