'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var express = require('express');
var path = require('path');

var Server = function () {
  function Server(Prerenderer) {
    _classCallCheck(this, Server);

    this._prerenderer = Prerenderer;
    this._options = Prerenderer.getOptions();
    this._expressServer = express();
    this._nativeServer = null;
  }

  _createClass(Server, [{
    key: 'initialize',
    value: function initialize() {
      var _this = this;

      var server = this._expressServer;

      this._prerenderer.modifyServer(this, 'pre-static');

      server.get('*.*', express.static(this._options.staticDir, {
        dotfiles: 'allow'
      }));

      this._prerenderer.modifyServer(this, 'post-static');

      this._prerenderer.modifyServer(this, 'pre-fallback');

      server.get('*', function (req, res) {
        res.sendFile(_this._options.indexPath ? _this._options.indexPath : path.join(_this._options.staticDir, 'index.html'));
      });

      this._prerenderer.modifyServer(this, 'post-fallback');

      return new Promise(function (resolve, reject) {
        _this._nativeServer = server.listen(_this._options.server.port, function () {
          resolve();
        });
      });
    }
  }, {
    key: 'destroy',
    value: function destroy() {
      this._nativeServer.close();
    }
  }]);

  return Server;
}();

module.exports = Server;
@@ -763,16 +763,62 @@
 ress');%0A
+var proxy = require('http-proxy-middleware');%0A
 var path
@@ -1520,24 +1520,943 @@
 allback');%0A%0A
+      if (this._options.server && this._options.server.proxy) %7B%0A        var _iteratorNormalCompletion = true;%0A        var _didIteratorError = false;%0A        var _iteratorError = undefined;%0A%0A        try %7B%0A          for (var _iterator = Object.keys(this._options.server.proxy)%5BSymbol.iterator%5D(), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) %7B%0A            var proxyPath = _step.value;%0A%0A            server.use(proxyPath, proxy(this._options.server.proxy%5BproxyPath%5D));%0A          %7D%0A        %7D catch (err) %7B%0A          _didIteratorError = true;%0A          _iteratorError = err;%0A        %7D finally %7B%0A          try %7B%0A            if (!_iteratorNormalCompletion && _iterator.return) %7B%0A              _iterator.return();%0A            %7D%0A          %7D finally %7B%0A            if (_didIteratorError) %7B%0A              throw _iteratorError;%0A            %7D%0A          %7D%0A        %7D%0A      %7D%0A%0A
       server

Bump version + proxy support.