const express = require('express');
const path = require('path');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./webpack.config');

const app = express();

const isDevelopment = process.env.NODE_ENV !== 'production';
if (isDevelopment) { // DEV SERVER
  new WebpackDevServer(webpack(config), {
    publicPath: config.output.publicPath,
    hot: true,
    historyApiFallback: true
  }).listen(5000, 'localhost', (err) => {
    if (err) {
      console.log(err);
    }
    console.log('Listening at localhost:5000');
  });
} else { // PRODUCTION SERVER
  app.set('port', (process.env.PORT || 5000));
  app.use(express.static(path.join(__dirname, '/static')));

  app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname, 'index.html'));
  });

  app.listen(app.get('port'), () => {
    console.log('Node app is running on port', app.get('port'));
  });
}

@@ -63,566 +63,33 @@
 ');%0A
-const webpack = require('webpack');%0Aconst WebpackDevServer = require('webpack-dev-server');%0Aconst config = require('./webpack.config');%0A%0Aconst app = express();%0A%0Aconst isDevelopment = process.env.NODE_ENV !== 'production';%0Aif (isDevelopment) %7B // DEV SERVER%0A  new WebpackDevServer(webpack(config), %7B%0A    publicPath: config.output.publicPath,%0A    hot: true,%0A    historyApiFallback: true%0A  %7D).listen(5000, 'localhost', (err) =%3E %7B%0A    if (err) %7B%0A      console.log(err);%0A    %7D%0A    console.log('Listening at localhost:5000');%0A  %7D);%0A%7D else %7B // PRODUCTION SERVER%0A  
+%0Aconst app = express();%0A%0A
 app.
@@ -129,18 +129,16 @@
 5000));%0A
-  
 app.use(
@@ -184,26 +184,24 @@
 tatic')));%0A%0A
-  
 app.get('/',
@@ -217,18 +217,16 @@
 s) =%3E %7B%0A
-  
   res.se
@@ -273,17 +273,13 @@
 ));%0A
-  
 %7D);%0A%0A
-  
 app.
@@ -310,18 +310,16 @@
 () =%3E %7B%0A
-  
   consol
@@ -377,12 +377,8 @@
 ));%0A
-  
 %7D);%0A
-%7D%0A

remove dev server