old_contents: import path from 'path';
  import webpack from 'webpack';
  import express from 'express';
  import fs from 'fs';
  import config from './webpack.config';
  
  const app = express();
  const compiler = webpack(config);
  
  const trustedUri = 'localhost:3000';
  
  app.use(require('webpack-dev-middleware')(compiler, {
    publicPath: config.output.publicPath
  }));
  
  app.use(require('webpack-hot-middleware')(compiler));
  app.use(express.static('public'));
  
  app.get('/api/assets/', function(req, res, next) {
    /**
     * надо понадежнее закрыть данные для скачек
     */
    if (req.headers.host === trustedUri) {
      next();
    }
  }, function (req, res) {
    const svgPath = 'public/svg/';
    const svgFolders = require('./data/assets');
    const data = svgFolders.map(folder => {
      const colors = folder.colors.map(color => {
        return Object.assign({}, color, {
          files: fs.readdirSync(path.join(svgPath, folder.id, color.id))
        });
      });
  
      return Object.assign({}, folder, {
        colors
      });
    });
    res.setHeader('Content-Type', 'application/json');
    res.send(JSON.stringify(data));
  });
  
  app.listen(3000, function(err) {
    if (err) {
      return console.error(err);
    }
  
    console.log('Listening at http://' + trustedUri + '/');
  });
  
new_contents: import path from 'path';
  import webpack from 'webpack';
  import express from 'express';
  import fs from 'fs';
  import config from './webpack.config';
  
  const app = express();
  const compiler = webpack(config);
  
  const port = 3000;
  const trustedUri = `localhost:${port}`;
  
  app.use(require('webpack-dev-middleware')(compiler, {
    publicPath: config.output.publicPath
  }));
  
  app.use(require('webpack-hot-middleware')(compiler));
  app.use(express.static('public'));
  
  app.get('/api/assets/', function(req, res, next) {
    /**
     * надо понадежнее закрыть данные для скачек
     */
    if (req.headers.host === trustedUri) {
      next();
    }
  }, function (req, res) {
    const svgPath = 'public/svg/';
    const svgFolders = require('./data/assets');
    const data = svgFolders.map(folder => {
      const colors = folder.colors.map(color => {
        return Object.assign({}, color, {
          files: fs.readdirSync(path.join(svgPath, folder.id, color.id))
        });
      });
  
      return Object.assign({}, folder, {
        colors
      });
    });
    res.setHeader('Content-Type', 'application/json');
    res.send(JSON.stringify(data));
  });
  
  app.listen(port, function(err) {
    if (err) {
      return console.error(err);
    }
  
    console.log('Listening at http://' + trustedUri + '/');
  });
  
subject: Use port as variable